• Home
  • Raw
  • Download

Lines Matching refs:TimeVal

453 pub struct TimeVal(timeval);  struct
465 impl AsRef<timeval> for TimeVal { implementation
471 impl AsMut<timeval> for TimeVal { implementation
477 impl Ord for TimeVal { implementation
480 fn cmp(&self, other: &TimeVal) -> cmp::Ordering { in cmp()
489 impl PartialOrd for TimeVal { implementation
490 fn partial_cmp(&self, other: &TimeVal) -> Option<cmp::Ordering> { in partial_cmp()
495 impl TimeValLike for TimeVal { implementation
497 fn seconds(seconds: i64) -> TimeVal { in seconds() argument
505 TimeVal(timeval { in seconds()
512 fn milliseconds(milliseconds: i64) -> TimeVal { in milliseconds() argument
517 TimeVal::microseconds(microseconds) in milliseconds()
522 fn microseconds(microseconds: i64) -> TimeVal { in microseconds() argument
530 TimeVal(timeval { in microseconds()
539 fn nanoseconds(nanoseconds: i64) -> TimeVal { in nanoseconds() argument
548 TimeVal(timeval { in nanoseconds()
581 impl TimeVal { impl
609 impl ops::Neg for TimeVal { implementation
610 type Output = TimeVal;
612 fn neg(self) -> TimeVal { in neg() argument
613 TimeVal::microseconds(-self.num_microseconds()) in neg()
617 impl ops::Add for TimeVal { implementation
618 type Output = TimeVal;
620 fn add(self, rhs: TimeVal) -> TimeVal { in add() argument
621 TimeVal::microseconds(self.num_microseconds() + rhs.num_microseconds()) in add()
625 impl ops::Sub for TimeVal { implementation
626 type Output = TimeVal;
628 fn sub(self, rhs: TimeVal) -> TimeVal { in sub() argument
629 TimeVal::microseconds(self.num_microseconds() - rhs.num_microseconds()) in sub()
633 impl ops::Mul<i32> for TimeVal { implementation
634 type Output = TimeVal;
636 fn mul(self, rhs: i32) -> TimeVal { in mul() argument
642 TimeVal::microseconds(usec) in mul()
646 impl ops::Div<i32> for TimeVal { implementation
647 type Output = TimeVal;
649 fn div(self, rhs: i32) -> TimeVal { in div() argument
651 TimeVal::microseconds(usec) in div()
655 impl fmt::Display for TimeVal { implementation
683 impl From<timeval> for TimeVal { implementation
685 TimeVal(tv) in from()
717 use super::{TimeSpec, TimeVal, TimeValLike};
774 assert_ne!(TimeVal::seconds(1), TimeVal::zero()); in test_timeval()
776 TimeVal::seconds(1) + TimeVal::seconds(2), in test_timeval()
777 TimeVal::seconds(3) in test_timeval()
780 TimeVal::minutes(3) + TimeVal::seconds(2), in test_timeval()
781 TimeVal::seconds(182) in test_timeval()
787 assert_eq!(TimeVal::seconds(1), TimeVal::microseconds(1_000_000)); in test_timeval_ord()
788 assert!(TimeVal::seconds(1) < TimeVal::microseconds(1_000_001)); in test_timeval_ord()
789 assert!(TimeVal::seconds(1) > TimeVal::microseconds(999_999)); in test_timeval_ord()
790 assert!(TimeVal::seconds(-1) < TimeVal::microseconds(-999_999)); in test_timeval_ord()
791 assert!(TimeVal::seconds(-1) > TimeVal::microseconds(-1_000_001)); in test_timeval_ord()
796 let a = TimeVal::seconds(1) + TimeVal::microseconds(123); in test_timeval_neg()
797 let b = TimeVal::seconds(-1) + TimeVal::microseconds(-123); in test_timeval_neg()
804 assert_eq!(TimeVal::zero().to_string(), "0 seconds"); in test_timeval_fmt()
805 assert_eq!(TimeVal::seconds(42).to_string(), "42 seconds"); in test_timeval_fmt()
806 assert_eq!(TimeVal::milliseconds(42).to_string(), "0.042 seconds"); in test_timeval_fmt()
807 assert_eq!(TimeVal::microseconds(42).to_string(), "0.000042 seconds"); in test_timeval_fmt()
808 assert_eq!(TimeVal::nanoseconds(1402).to_string(), "0.000001 seconds"); in test_timeval_fmt()
809 assert_eq!(TimeVal::seconds(-86401).to_string(), "-86401 seconds"); in test_timeval_fmt()