@@ -69,7 +69,7 @@ pub fn test_timestamping() {
69
69
} else {
70
70
sys_time - ts
71
71
} ;
72
- assert ! ( std:: time:: Duration :: from ( diff) . as_secs( ) < 60 ) ;
72
+ assert ! ( std:: time:: Duration :: try_from ( diff) . unwrap ( ) . as_secs( ) < 60 ) ;
73
73
}
74
74
75
75
#[ cfg( target_os = "freebsd" ) ]
@@ -131,7 +131,7 @@ pub fn test_timestamping_realtime() {
131
131
} else {
132
132
sys_time - ts
133
133
} ;
134
- assert ! ( std:: time:: Duration :: from ( diff) . as_secs( ) < 60 ) ;
134
+ assert ! ( std:: time:: Duration :: try_from ( diff) . unwrap ( ) . as_secs( ) < 60 ) ;
135
135
}
136
136
137
137
#[ cfg( target_os = "freebsd" ) ]
@@ -189,7 +189,7 @@ pub fn test_timestamping_monotonic() {
189
189
:: nix:: time:: clock_gettime ( :: nix:: time:: ClockId :: CLOCK_MONOTONIC )
190
190
. unwrap ( ) ;
191
191
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 ) ;
193
193
}
194
194
195
195
#[ test]
@@ -2985,7 +2985,7 @@ pub fn test_txtime() {
2985
2985
let iov1 = [ std:: io:: IoSlice :: new ( & sbuf) ] ;
2986
2986
2987
2987
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 ( ) ;
2989
2989
let txtime = ( now + delay) . num_nanoseconds ( ) as u64 ;
2990
2990
2991
2991
let cmsg = ControlMessage :: TxTime ( & txtime) ;
@@ -3099,7 +3099,8 @@ fn test_recvmm2() -> nix::Result<()> {
3099
3099
3100
3100
let mut data = MultiHeaders :: < ( ) > :: preallocate ( recv_iovs. len ( ) , Some ( cmsg) ) ;
3101
3101
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 ) )
3103
+ . unwrap ( ) ;
3103
3104
3104
3105
let recv = recvmmsg (
3105
3106
rsock. as_raw_fd ( ) ,
@@ -3125,7 +3126,9 @@ fn test_recvmm2() -> nix::Result<()> {
3125
3126
} else {
3126
3127
sys_time - ts
3127
3128
} ;
3128
- assert ! ( std:: time:: Duration :: from( diff) . as_secs( ) < 60 ) ;
3129
+ assert ! (
3130
+ std:: time:: Duration :: try_from( diff) . unwrap( ) . as_secs( ) < 60
3131
+ ) ;
3129
3132
#[ cfg( not( any( qemu, target_arch = "aarch64" ) ) ) ]
3130
3133
{
3131
3134
saw_time = true ;
0 commit comments