@@ -69,7 +69,7 @@ pub fn test_timestamping() {
6969 } else {
7070 sys_time - ts
7171 } ;
72- assert ! ( std:: time:: Duration :: from ( diff) . as_secs( ) < 60 ) ;
72+ assert ! ( std:: time:: Duration :: try_from ( diff) . unwrap ( ) . as_secs( ) < 60 ) ;
7373}
7474
7575#[ cfg( target_os = "freebsd" ) ]
@@ -131,7 +131,7 @@ pub fn test_timestamping_realtime() {
131131 } else {
132132 sys_time - ts
133133 } ;
134- assert ! ( std:: time:: Duration :: from ( diff) . as_secs( ) < 60 ) ;
134+ assert ! ( std:: time:: Duration :: try_from ( diff) . unwrap ( ) . as_secs( ) < 60 ) ;
135135}
136136
137137#[ cfg( target_os = "freebsd" ) ]
@@ -189,7 +189,7 @@ pub fn test_timestamping_monotonic() {
189189 :: nix:: time:: clock_gettime ( :: nix:: time:: ClockId :: CLOCK_MONOTONIC )
190190 . unwrap ( ) ;
191191 let diff = sys_time - ts; // Monotonic clock sys_time must be greater
192- assert ! ( std:: time:: Duration :: from ( diff) . as_secs( ) < 60 ) ;
192+ assert ! ( std:: time:: Duration :: try_from ( diff) . unwrap ( ) . as_secs( ) < 60 ) ;
193193}
194194
195195#[ test]
@@ -2985,7 +2985,7 @@ pub fn test_txtime() {
29852985 let iov1 = [ std:: io:: IoSlice :: new ( & sbuf) ] ;
29862986
29872987 let now = clock_gettime ( ClockId :: CLOCK_MONOTONIC ) . unwrap ( ) ;
2988- let delay = std:: time:: Duration :: from_secs ( 1 ) . into ( ) ;
2988+ let delay = std:: time:: Duration :: from_secs ( 1 ) . try_into ( ) . unwrap ( ) ;
29892989 let txtime = ( now + delay) . num_nanoseconds ( ) as u64 ;
29902990
29912991 let cmsg = ControlMessage :: TxTime ( & txtime) ;
@@ -3099,7 +3099,7 @@ fn test_recvmm2() -> nix::Result<()> {
30993099
31003100 let mut data = MultiHeaders :: < ( ) > :: preallocate ( recv_iovs. len ( ) , Some ( cmsg) ) ;
31013101
3102- let t = TimeSpec :: from_duration ( std:: time:: Duration :: from_secs ( 10 ) ) ;
3102+ let t = TimeSpec :: try_from_duration ( std:: time:: Duration :: from_secs ( 10 ) ) . unwrap ( ) ;
31033103
31043104 let recv = recvmmsg (
31053105 rsock. as_raw_fd ( ) ,
@@ -3125,7 +3125,7 @@ fn test_recvmm2() -> nix::Result<()> {
31253125 } else {
31263126 sys_time - ts
31273127 } ;
3128- assert ! ( std:: time:: Duration :: from ( diff) . as_secs( ) < 60 ) ;
3128+ assert ! ( std:: time:: Duration :: try_from ( diff) . unwrap ( ) . as_secs( ) < 60 ) ;
31293129 #[ cfg( not( any( qemu, target_arch = "aarch64" ) ) ) ]
31303130 {
31313131 saw_time = true ;
0 commit comments