Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump version of filetime dependency #5379

Merged
merged 1 commit into from
Apr 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ crypto-hash = "0.3"
curl = "0.4.6"
env_logger = "0.5"
failure = "0.1.1"
filetime = "0.1"
filetime = "0.2"
flate2 = "1.0"
fs2 = "0.4"
git2 = "0.7.0"
Expand Down
6 changes: 3 additions & 3 deletions src/cargo/core/compiler/fingerprint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ impl ser::Serialize for MtimeSlot {
self.0
.lock()
.unwrap()
.map(|ft| (ft.seconds_relative_to_1970(), ft.nanoseconds()))
.map(|ft| (ft.unix_seconds(), ft.nanoseconds()))
.serialize(s)
}
}
Expand All @@ -396,9 +396,9 @@ impl<'de> de::Deserialize<'de> for MtimeSlot {
where
D: de::Deserializer<'de>,
{
let kind: Option<(u64, u32)> = de::Deserialize::deserialize(d)?;
let kind: Option<(i64, u32)> = de::Deserialize::deserialize(d)?;
Ok(MtimeSlot(Mutex::new(kind.map(|(s, n)| {
FileTime::from_seconds_since_1970(s, n)
FileTime::from_unix_time(s, n)
}))))
}
}
Expand Down
12 changes: 6 additions & 6 deletions tests/testsuite/cargotest/support/paths.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ pub trait CargoPathExt {

fn move_in_time<F>(&self, travel_amount: F)
where
F: Fn(u64, u32) -> (u64, u32);
F: Fn(i64, u32) -> (i64, u32);
}

impl CargoPathExt for Path {
Expand Down Expand Up @@ -102,7 +102,7 @@ impl CargoPathExt for Path {

fn move_in_time<F>(&self, travel_amount: F)
where
F: Fn(u64, u32) -> ((u64, u32)),
F: Fn(i64, u32) -> ((i64, u32)),
{
if self.is_file() {
time_travel(self, &travel_amount);
Expand All @@ -112,7 +112,7 @@ impl CargoPathExt for Path {

fn recurse<F>(p: &Path, bad: &Path, travel_amount: &F)
where
F: Fn(u64, u32) -> ((u64, u32)),
F: Fn(i64, u32) -> ((i64, u32)),
{
if p.is_file() {
time_travel(p, travel_amount)
Expand All @@ -126,14 +126,14 @@ impl CargoPathExt for Path {

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

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

let (sec, nsec) = travel_amount(mtime.seconds_relative_to_1970(), mtime.nanoseconds());
let newtime = FileTime::from_seconds_since_1970(sec, nsec);
let (sec, nsec) = travel_amount(mtime.unix_seconds(), mtime.nanoseconds());
let newtime = FileTime::from_unix_time(sec, nsec);

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