Skip to content

Commit 11777ef

Browse files
committed
Auto merge of #5379 - alexcrichton:bump-fieltime, r=matklad
Bump version of `filetime` dependency
2 parents 3c52362 + 039ca01 commit 11777ef

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ crypto-hash = "0.3"
2424
curl = "0.4.6"
2525
env_logger = "0.5"
2626
failure = "0.1.1"
27-
filetime = "0.1"
27+
filetime = "0.2"
2828
flate2 = "1.0"
2929
fs2 = "0.4"
3030
git2 = "0.7.0"

src/cargo/core/compiler/fingerprint.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ impl ser::Serialize for MtimeSlot {
386386
self.0
387387
.lock()
388388
.unwrap()
389-
.map(|ft| (ft.seconds_relative_to_1970(), ft.nanoseconds()))
389+
.map(|ft| (ft.unix_seconds(), ft.nanoseconds()))
390390
.serialize(s)
391391
}
392392
}
@@ -396,9 +396,9 @@ impl<'de> de::Deserialize<'de> for MtimeSlot {
396396
where
397397
D: de::Deserializer<'de>,
398398
{
399-
let kind: Option<(u64, u32)> = de::Deserialize::deserialize(d)?;
399+
let kind: Option<(i64, u32)> = de::Deserialize::deserialize(d)?;
400400
Ok(MtimeSlot(Mutex::new(kind.map(|(s, n)| {
401-
FileTime::from_seconds_since_1970(s, n)
401+
FileTime::from_unix_time(s, n)
402402
}))))
403403
}
404404
}

tests/testsuite/cargotest/support/paths.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ pub trait CargoPathExt {
6969

7070
fn move_in_time<F>(&self, travel_amount: F)
7171
where
72-
F: Fn(u64, u32) -> (u64, u32);
72+
F: Fn(i64, u32) -> (i64, u32);
7373
}
7474

7575
impl CargoPathExt for Path {
@@ -102,7 +102,7 @@ impl CargoPathExt for Path {
102102

103103
fn move_in_time<F>(&self, travel_amount: F)
104104
where
105-
F: Fn(u64, u32) -> ((u64, u32)),
105+
F: Fn(i64, u32) -> ((i64, u32)),
106106
{
107107
if self.is_file() {
108108
time_travel(self, &travel_amount);
@@ -112,7 +112,7 @@ impl CargoPathExt for Path {
112112

113113
fn recurse<F>(p: &Path, bad: &Path, travel_amount: &F)
114114
where
115-
F: Fn(u64, u32) -> ((u64, u32)),
115+
F: Fn(i64, u32) -> ((i64, u32)),
116116
{
117117
if p.is_file() {
118118
time_travel(p, travel_amount)
@@ -126,14 +126,14 @@ impl CargoPathExt for Path {
126126

127127
fn time_travel<F>(path: &Path, travel_amount: &F)
128128
where
129-
F: Fn(u64, u32) -> ((u64, u32)),
129+
F: Fn(i64, u32) -> ((i64, u32)),
130130
{
131131
let stat = t!(path.metadata());
132132

133133
let mtime = FileTime::from_last_modification_time(&stat);
134134

135-
let (sec, nsec) = travel_amount(mtime.seconds_relative_to_1970(), mtime.nanoseconds());
136-
let newtime = FileTime::from_seconds_since_1970(sec, nsec);
135+
let (sec, nsec) = travel_amount(mtime.unix_seconds(), mtime.nanoseconds());
136+
let newtime = FileTime::from_unix_time(sec, nsec);
137137

138138
// Sadly change_file_times has a failure mode where a readonly file
139139
// cannot have its times changed on windows.

0 commit comments

Comments
 (0)