Skip to content

Commit b0fac9f

Browse files
committed
Upgrade to time 0.3
1 parent 77557f2 commit b0fac9f

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ name = "humantime"
1919
path = "src/lib.rs"
2020

2121
[dev-dependencies]
22-
time = "0.1"
22+
time = { version = "0.3", features = ["formatting"] }
2323
chrono = "0.4"
2424
rand = "0.6"

src/date.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)