[Toybox] [PATCH] date: fix various time zone/daylight time issues.

enh enh at google.com
Tue Mar 12 18:09:10 PDT 2019


Sunday's transition in the US broke a bunch of the tests. Worse, it
broke some of the QA folks' scripts. Finally, the boil that is date's
handling of time zones and daylight time has come to a head...

This patch fixes the newly-failing tests *and* the other tests that were
checked in failing to serve as TODOs.

I've resolved the test TODOs about whether implied year/century in POSIX
format should mean the current year or 1900 in favor of the current
year. Both busybox and coreutils agree, and Rob fixed the code recently
so toybox agrees too, but without fixing the tests.

I've switched tests from Europe/London to Europe/Berlin to avoid
disagreements between C libraries about whether to say "GMT" or "UTC"
when daylight savings is not in force.

The majority of this patch implements what I'd been unsuccessfully
trying to explain on the list: that to correctly implement the distinct
input and output time zones (as demonstrated in the three failing tests
we've been carrying around for a while), we should switch to working
with time_t internally rather than struct tm. I've also added the code
to temporarily switch to the input time zone (and back again).

All the tests now pass.
---
 tests/date.test   |  25 ++++----
 toys/posix/date.c | 157 +++++++++++++++++++++++++++-------------------
 2 files changed, 106 insertions(+), 76 deletions(-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-date-fix-various-time-zone-daylight-time-issues.patch
Type: text/x-patch
Size: 12922 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20190312/0ff923c5/attachment.bin>


More information about the Toybox mailing list