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

update time crate to 0.3 #3319

Merged
merged 22 commits into from
May 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
ca67014
build(deps): bump time from 0.1.43 to 0.3.9
sylvestre Apr 27, 2022
f810b55
build in verbose mode (cfg isn't used)
sylvestre Apr 23, 2022
3a576f2
time: Various fixes
sylvestre Apr 23, 2022
e23dd68
time: Force the display of the tz sign
sylvestre Apr 24, 2022
326dc50
stat: add a test to verify time easily
sylvestre Apr 24, 2022
10eaaae
time: take in account the local tz
sylvestre Apr 24, 2022
3b3585b
add time 0.1.44 to cargo deny
sylvestre Apr 27, 2022
c009e1b
workaround the tests/touch/60-seconds test to skip leap second
sylvestre Apr 27, 2022
2b11d77
time: Improve the l&f
sylvestre Apr 28, 2022
31c28ee
fix gnu/tests/touch/60-seconds
sylvestre Apr 29, 2022
9d81d6f
touch: add support of -d '1970-01-01 18:43:33.023456789'
sylvestre Apr 29, 2022
417b4a2
GNU CI: show the new error
sylvestre May 1, 2022
9b69e6f
Merge branch 'main' into 2884-time-0.3
sylvestre May 2, 2022
0b9d703
Merge branch 'main' into 2884-time-0.3
sylvestre May 2, 2022
e70b99d
touch: add support of -d '1970-01-01 18:43:33.023456789'
sylvestre Apr 29, 2022
65d0f5b
to_local: manage the error
sylvestre May 2, 2022
06ef89b
touch: improve the -d option support of other dates
sylvestre May 5, 2022
39520a8
fix the GNU error detection
sylvestre May 6, 2022
56264eb
Merge branch 'main' into 2884-time-0.3
sylvestre May 7, 2022
087d4b1
Do not use the Rust/touch for tests/ls/abmon-align.sh
sylvestre May 8, 2022
d556984
also support for tests/touch/no-rights.sh format
sylvestre May 8, 2022
f65d72e
also support for tests/touch/relative.sh
sylvestre May 8, 2022
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
9 changes: 9 additions & 0 deletions .cargo/config
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,12 @@ rustflags = [
"-Wclippy::single_char_pattern",
"-Wclippy::explicit_iter_loop",
]

[build]
# See https://github.com/time-rs/time/issues/293#issuecomment-1005002386. The
# unsoundness here is not in the `time` library, but in the Rust stdlib, and as
# such it needs to be fixed there.
rustflags = "--cfg unsound_local_offset"

[target.'cfg(target_os = "linux")']
rustflags = ["--cfg", "unsound_local_offset"]
4 changes: 2 additions & 2 deletions .github/workflows/CICD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -384,9 +384,9 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: test
args: ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }} -p uucore -p coreutils
args: -v ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }} -p uucore -p coreutils
env:
RUSTFLAGS: "-Awarnings"
RUSTFLAGS: "-Awarnings --cfg unsound_local_offset"

deps:
name: Dependencies
Expand Down
53 changes: 44 additions & 9 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ rand = "0.8"
regex = "1.5"
sha1 = { version="0.10", features=["std"] }
tempfile = "3"
time = "0.1"
time = {version="0.3", features=["local-offset"]}
unindent = "0.1"
uucore = { version=">=0.0.11", package="uucore", path="src/uucore", features=["entries", "process"] }
walkdir = "2.2"
Expand Down
6 changes: 5 additions & 1 deletion deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ unmaintained = "warn"
yanked = "warn"
notice = "warn"
ignore = [
"RUSTSEC-2020-0159",
"RUSTSEC-2020-0071",
#"RUSTSEC-0000-0000",
]

Expand Down Expand Up @@ -62,7 +64,7 @@ highlight = "all"
# spell-checker: disable
skip = [
# getrandom
{ name = "wasi", version="0.10.2+wasi-snapshot-preview1" },
{ name = "wasi", version="0.10.0+wasi-snapshot-preview1" },
# blake2d_simd
{ name = "arrayvec", version = "=0.7.2" },
# flimit/unix_socket
Expand All @@ -84,6 +86,8 @@ skip = [
{ name = "memchr", version = "=1.0.2" },
{ name = "quote", version = "=0.3.15" },
{ name = "unicode-xid", version = "=0.0.4" },
# chrono
{ name = "time", version = "=0.1.44" },
]
# spell-checker: enable

Expand Down
3 changes: 3 additions & 0 deletions src/uu/install/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ file_diff = "1.0.0"
libc = ">= 0.2"
uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["fs", "mode", "perms", "entries"] }

[dev-dependencies]
time = "0.3"

[[bin]]
name = "install"
path = "src/main.rs"
10 changes: 7 additions & 3 deletions src/uu/pinky/src/pinky.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,10 @@ impl Capitalize for str {

fn idle_string(when: i64) -> String {
thread_local! {
static NOW: time::Tm = time::now()
static NOW: time::OffsetDateTime = time::OffsetDateTime::now_local().unwrap();
}
NOW.with(|n| {
let duration = n.to_timespec().sec - when;
let duration = n.unix_timestamp() - when;
if duration < 60 {
// less than 1min
" ".to_owned()
Expand All @@ -242,7 +242,11 @@ fn idle_string(when: i64) -> String {
}

fn time_string(ut: &Utmpx) -> String {
time::strftime("%b %e %H:%M", &ut.login_time()).unwrap() // LC_ALL=C
// "%b %e %H:%M"
let time_format: Vec<time::format_description::FormatItem> =
time::format_description::parse("[month repr:short] [day padding:space] [hour]:[minute]")
.unwrap();
ut.login_time().format(&time_format).unwrap() // LC_ALL=C
}

fn gecos_to_fullname(pw: &Passwd) -> Option<String> {
Expand Down
2 changes: 1 addition & 1 deletion src/uu/touch/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ path = "src/touch.rs"
[dependencies]
filetime = "0.2.1"
clap = { version = "3.1", features = ["wrap_help", "cargo"] }
time = "0.1.40"
time = { version = "0.3", features = ["parsing", "formatting", "local-offset", "macros"] }
uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["libc"] }

[target.'cfg(target_os = "windows")'.dependencies]
Expand Down
Loading