diff --git a/Cargo.lock b/Cargo.lock index 61965e127..e65344dba 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -283,7 +283,7 @@ name = "cp" version = "0.0.1" dependencies = [ "clap 2.31.2 (registry+https://github.com/rust-lang/crates.io-index)", - "filetime 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", + "filetime 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", "ioctl-sys 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -524,7 +524,7 @@ dependencies = [ [[package]] name = "filetime" -version = "0.1.15" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1425,7 +1425,7 @@ dependencies = [ name = "shred" version = "0.0.1" dependencies = [ - "filetime 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", + "filetime 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1686,7 +1686,7 @@ dependencies = [ name = "touch" version = "0.0.1" dependencies = [ - "filetime 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", + "filetime 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.1", @@ -1901,7 +1901,7 @@ dependencies = [ "expr 0.0.1", "factor 0.0.1", "false 0.0.1", - "filetime 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", + "filetime 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "fmt 0.0.1", "fold 0.0.1", "groups 0.0.1", @@ -2118,7 +2118,7 @@ dependencies = [ "checksum failure 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "934799b6c1de475a012a02dab0ace1ace43789ee4b99bcfbf1a2e3e8ced5de82" "checksum failure_derive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c7cdda555bb90c9bb67a3b670a0f42de8e73f5981524123ad8578aafec8ddb8b" "checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" -"checksum filetime 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "714653f3e34871534de23771ac7b26e999651a0a228f47beb324dfdf1dd4b10f" +"checksum filetime 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "da4b9849e77b13195302c174324b5ba73eec9b236b24c221a61000daefb95c5f" "checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" "checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" "checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" diff --git a/Cargo.toml b/Cargo.toml index dfcd21894..2d4db7b77 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -250,7 +250,7 @@ yes = { optional=true, path="src/yes" } [dev-dependencies] time = "0.1.38" -filetime = "0.1.10" +filetime = "0.2.1" libc = "0.2.42" regex = "0.2.2" rand = "0.4.2" diff --git a/src/cp/Cargo.toml b/src/cp/Cargo.toml index 0cb25dc1d..9e96b0a1d 100644 --- a/src/cp/Cargo.toml +++ b/src/cp/Cargo.toml @@ -17,7 +17,7 @@ libc = "0.2.42" walkdir = "2.1.4" clap = "2.31.2" quick-error = "1.2.2" -filetime = "0.1" +filetime = "0.2" [dependencies.uucore] path = "../uucore" diff --git a/src/shred/Cargo.toml b/src/shred/Cargo.toml index 9d2ab6b39..4336c1416 100644 --- a/src/shred/Cargo.toml +++ b/src/shred/Cargo.toml @@ -10,7 +10,7 @@ path = "shred.rs" [dependencies] rand = "0.4" -filetime = "0.1.10" +filetime = "0.2.1" getopts = "0.2.14" libc = "0.2.42" time = "0.1.38" diff --git a/src/touch/Cargo.toml b/src/touch/Cargo.toml index 90dcae2b3..cd1ef75f6 100644 --- a/src/touch/Cargo.toml +++ b/src/touch/Cargo.toml @@ -9,7 +9,7 @@ name = "uu_touch" path = "touch.rs" [dependencies] -filetime = "0.1.10" +filetime = "0.2.1" getopts = "0.2.14" time = "0.1.38" diff --git a/src/touch/touch.rs b/src/touch/touch.rs index e0608f16f..5db4deb11 100644 --- a/src/touch/touch.rs +++ b/src/touch/touch.rs @@ -38,7 +38,7 @@ macro_rules! to_local( macro_rules! local_tm_to_filetime( ($exp:expr) => ({ let ts = $exp.to_timespec(); - FileTime::from_seconds_since_1970(ts.sec as u64, ts.nsec as u32) + FileTime::from_unix_time(ts.sec as i64, ts.nsec as u32) }) ); diff --git a/tests/test_mv.rs b/tests/test_mv.rs index 4d08f799f..870524b27 100644 --- a/tests/test_mv.rs +++ b/tests/test_mv.rs @@ -265,8 +265,8 @@ fn test_mv_update_option() { at.touch(file_a); at.touch(file_b); let ts = time::now().to_timespec(); - let now = FileTime::from_seconds_since_1970(ts.sec as u64, ts.nsec as u32); - let later = FileTime::from_seconds_since_1970(ts.sec as u64 + 3600, ts.nsec as u32); + let now = FileTime::from_unix_time(ts.sec as i64, ts.nsec as u32); + let later = FileTime::from_unix_time(ts.sec as i64 + 3600, ts.nsec as u32); filetime::set_file_times(at.plus_as_string(file_a), now, now).unwrap(); filetime::set_file_times(at.plus_as_string(file_b), now, later).unwrap(); diff --git a/tests/test_touch.rs b/tests/test_touch.rs index 1296dacdb..8cc2e21a7 100644 --- a/tests/test_touch.rs +++ b/tests/test_touch.rs @@ -26,7 +26,7 @@ fn str_to_filetime(format: &str, s: &str) -> FileTime { let mut tm = time::strptime(s, format).unwrap(); tm.tm_utcoff = time::now().tm_utcoff; let ts = tm.to_timespec(); - FileTime::from_seconds_since_1970(ts.sec as u64, ts.nsec as u32) + FileTime::from_unix_time(ts.sec as i64, ts.nsec as u32) } #[test] @@ -75,9 +75,9 @@ fn test_touch_set_mdhm_time() { let start_of_year = str_to_filetime("%Y%m%d%H%M", &format!("{}01010000", 1900+time::now().tm_year)); let (atime, mtime) = get_file_times(&at, file); assert_eq!(atime, mtime); - assert_eq!(atime.seconds_relative_to_1970() - start_of_year.seconds_relative_to_1970(), + assert_eq!(atime.unix_seconds() - start_of_year.unix_seconds(), 45240); - assert_eq!(mtime.seconds_relative_to_1970() - start_of_year.seconds_relative_to_1970(), + assert_eq!(mtime.unix_seconds() - start_of_year.unix_seconds(), 45240); } @@ -93,9 +93,9 @@ fn test_touch_set_mdhms_time() { let start_of_year = str_to_filetime("%Y%m%d%H%M.%S", &format!("{}01010000.00", 1900+time::now().tm_year)); let (atime, mtime) = get_file_times(&at, file); assert_eq!(atime, mtime); - assert_eq!(atime.seconds_relative_to_1970() - start_of_year.seconds_relative_to_1970(), + assert_eq!(atime.unix_seconds() - start_of_year.unix_seconds(), 45296); - assert_eq!(mtime.seconds_relative_to_1970() - start_of_year.seconds_relative_to_1970(), + assert_eq!(mtime.unix_seconds() - start_of_year.unix_seconds(), 45296); } @@ -111,9 +111,9 @@ fn test_touch_set_ymdhm_time() { let start_of_year = str_to_filetime("%y%m%d%H%M", "1501010000"); let (atime, mtime) = get_file_times(&at, file); assert_eq!(atime, mtime); - assert_eq!(atime.seconds_relative_to_1970() - start_of_year.seconds_relative_to_1970(), + assert_eq!(atime.unix_seconds() - start_of_year.unix_seconds(), 45240); - assert_eq!(mtime.seconds_relative_to_1970() - start_of_year.seconds_relative_to_1970(), + assert_eq!(mtime.unix_seconds() - start_of_year.unix_seconds(), 45240); } @@ -129,9 +129,9 @@ fn test_touch_set_ymdhms_time() { let start_of_year = str_to_filetime("%y%m%d%H%M.%S", "1501010000.00"); let (atime, mtime) = get_file_times(&at, file); assert_eq!(atime, mtime); - assert_eq!(atime.seconds_relative_to_1970() - start_of_year.seconds_relative_to_1970(), + assert_eq!(atime.unix_seconds() - start_of_year.unix_seconds(), 45296); - assert_eq!(mtime.seconds_relative_to_1970() - start_of_year.seconds_relative_to_1970(), + assert_eq!(mtime.unix_seconds() - start_of_year.unix_seconds(), 45296); } @@ -147,9 +147,9 @@ fn test_touch_set_cymdhm_time() { let start_of_year = str_to_filetime("%Y%m%d%H%M", "201501010000"); let (atime, mtime) = get_file_times(&at, file); assert_eq!(atime, mtime); - assert_eq!(atime.seconds_relative_to_1970() - start_of_year.seconds_relative_to_1970(), + assert_eq!(atime.unix_seconds() - start_of_year.unix_seconds(), 45240); - assert_eq!(mtime.seconds_relative_to_1970() - start_of_year.seconds_relative_to_1970(), + assert_eq!(mtime.unix_seconds() - start_of_year.unix_seconds(), 45240); } @@ -165,9 +165,9 @@ fn test_touch_set_cymdhms_time() { let start_of_year = str_to_filetime("%Y%m%d%H%M.%S", "201501010000.00"); let (atime, mtime) = get_file_times(&at, file); assert_eq!(atime, mtime); - assert_eq!(atime.seconds_relative_to_1970() - start_of_year.seconds_relative_to_1970(), + assert_eq!(atime.unix_seconds() - start_of_year.unix_seconds(), 45296); - assert_eq!(mtime.seconds_relative_to_1970() - start_of_year.seconds_relative_to_1970(), + assert_eq!(mtime.unix_seconds() - start_of_year.unix_seconds(), 45296); } @@ -183,7 +183,7 @@ fn test_touch_set_only_atime() { let start_of_year = str_to_filetime("%Y%m%d%H%M", "201501010000"); let (atime, mtime) = get_file_times(&at, file); assert!(atime != mtime); - assert_eq!(atime.seconds_relative_to_1970() - start_of_year.seconds_relative_to_1970(), + assert_eq!(atime.unix_seconds() - start_of_year.unix_seconds(), 45240); } @@ -199,7 +199,7 @@ fn test_touch_set_only_mtime() { let start_of_year = str_to_filetime("%Y%m%d%H%M", "201501010000"); let (atime, mtime) = get_file_times(&at, file); assert!(atime != mtime); - assert_eq!(mtime.seconds_relative_to_1970() - start_of_year.seconds_relative_to_1970(), + assert_eq!(mtime.unix_seconds() - start_of_year.unix_seconds(), 45240); } @@ -215,9 +215,9 @@ fn test_touch_set_both() { let start_of_year = str_to_filetime("%Y%m%d%H%M", "201501010000"); let (atime, mtime) = get_file_times(&at, file); assert_eq!(atime, mtime); - assert_eq!(atime.seconds_relative_to_1970() - start_of_year.seconds_relative_to_1970(), + assert_eq!(atime.unix_seconds() - start_of_year.unix_seconds(), 45240); - assert_eq!(mtime.seconds_relative_to_1970() - start_of_year.seconds_relative_to_1970(), + assert_eq!(mtime.unix_seconds() - start_of_year.unix_seconds(), 45240); }