File tree Expand file tree Collapse file tree 2 files changed +7
-7
lines changed
Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,6 @@ name = "humantime"
1919path = " src/lib.rs"
2020
2121[dev-dependencies ]
22- time = " 0.1 "
22+ time = { version = " 0.3 " , features = [ " formatting " ] }
2323chrono = " 0.4"
2424rand = " 0.6"
Original file line number Diff line number Diff line change @@ -379,19 +379,19 @@ mod test {
379379 use std:: time:: { Duration , SystemTime , UNIX_EPOCH } ;
380380
381381 use rand:: Rng ;
382+ use time:: format_description:: well_known:: Rfc3339 ;
383+ use time:: UtcDateTime ;
382384
383385 use super :: format_rfc3339_nanos;
384386 use super :: max;
385387 use super :: { format_rfc3339, parse_rfc3339, parse_rfc3339_weak} ;
386388 use super :: { format_rfc3339_micros, format_rfc3339_millis} ;
387389
388390 fn from_sec ( sec : u64 ) -> ( String , SystemTime ) {
389- let s = time:: at_utc ( time:: Timespec {
390- sec : sec as i64 ,
391- nsec : 0 ,
392- } )
393- . rfc3339 ( )
394- . to_string ( ) ;
391+ let s = UtcDateTime :: from_unix_timestamp ( sec as i64 )
392+ . unwrap ( )
393+ . format ( & Rfc3339 )
394+ . unwrap ( ) ;
395395 let time = UNIX_EPOCH + Duration :: new ( sec, 0 ) ;
396396 ( s, time)
397397 }
You can’t perform that action at this time.
0 commit comments