date: improve timezone handling and UTC mode support
- Add proper UTC mode handling with -u flag
- Improve TZ environment variable support
- Add more TZ tests
FIXES #7497 FIXES #7498
GNU testsuite comparison:
Skipping an intermittent issue tests/misc/stdbuf (passes in this run but fails in the 'main' branch)
Can you please run cargo clippy? The corresponding checks fail in the CI :|
Can you please run
cargo clippy? The corresponding checks fail in the CI :|
Done and Thanks.
GNU testsuite comparison:
Skip an intermittent issue tests/timeout/timeout (fails in this run but passes in the 'main' branch)
Side note: it seems our cargo fmt disagree on some minor stuff. I'm on +stable.
GNU testsuite comparison:
Skip an intermittent issue tests/misc/stdbuf (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/tail/inotify-dir-recreate (fails in this run but passes in the 'main' branch)
GNU testsuite comparison:
Skip an intermittent issue tests/timeout/timeout (fails in this run but passes in the 'main' branch)
@jadijadi looking at this a bit more... I feel like this would be better fixed in chrono, not here (I was looking at #7504 and couldn't really fully grasp why uucore handling code needs to be so complicated...).
See https://github.com/chronotope/chrono/issues/1690 . If you're interested to submit a patch for chrono I'm happy to leave it to you, just let me know.
If we have problems getting this fix into chrono (or if getting a new release takes time), we could think of some wrapper in uucore that fixes this for all the apps that handle dates (not just date, but also ls and du).
Argh, maybe I'm wrong, I think we still need some custom logic to handle timezone passed in TZ (i.e. to be able to read the abbreviation from the timezone database).
But... I think we can make things easier by having a wrapper function that returns something like this:
date.with_timezone(&tz)
(where tz comes from the code we already have in timezone_abbreviation)
@jadijadi are you still working on it ? thanks :)
(btw the empty TZ case is fixed in chrono, but we need to wait for a new release: https://github.com/chronotope/chrono/pull/1691)
@jadijadi are you still working on it ? thanks :)
yes. had a busy week. will work on it during this long weekend
waiting for update
I'm a bit lost on this. As @drinkcat mentioned, its better to have most of these fixes in chrono. And they are already fixed there. So maybe its better to close this PR and wait for chrono changes to be merged and work on this again based on what they have.
I'm still having busy work days and wont have time to go deeper and see what is changed in upcomming days. If anyone else wants to finish this, I will be happy.
I... also lost all context... and if it's not clear from my comments, I was also a bit confused a few weeks ago when I tried to look at this ,-)
- I pinged chrono maintainer here: https://github.com/chronotope/chrono/pull/1691, would be good to at least have the empty
TZcovered. - I'll resume my efforts on #7504, hopefully in the process I'll understand better what needs to be done here (I think it's technically orthogonal, but some of the refactoring will probably conflict with this PR)
I will close this because most fixed are already done in https://github.com/chronotope/chrono/pull/1691 . Will open another PR if I work on the remaining issues.