1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

tmdata: prioritise "UTC" over "GMT"

"UTC" is the modern name for what used to be "GMT", but ksh still
preferred GMT. On systems configured to use the UTC time zone, this
caused a 'printf %T' regression test failure in tests/builtins.sh
as the external 'data' utility will prefer UTC these days.

src/lib/libast/tm/tmdata.c:
- Reorder the name alternatives for UTC/GMT so that UTC is
  the first preference.

src/cmd/ksh93/tests/builtins.sh:
- Report expected and actual values on 'printf %T' failure.

Related: #6
This commit is contained in:
Martijn Dekker 2020-06-26 13:07:51 +02:00
parent f811482350
commit c9634e908d
2 changed files with 7 additions and 6 deletions

View file

@ -310,9 +310,10 @@ then err_exit "printf '%..*s' not working"
fi
[[ $(printf '%q\n') == '' ]] || err_exit 'printf "%q" with missing arguments'
# we won't get hit by the one second boundary twice, right?
[[ $(LC_ALL=C printf '%T\n' now) == "$(LC_ALL=C date)" ]] ||
[[ $(LC_ALL=C printf '%T\n' now) == "$(LC_ALL=C date)" ]] ||
err_exit 'printf "%T" now'
expect= actual=
{ expect=$(LC_ALL=C date) && actual=$(LC_ALL=C printf '%T\n' now) && [[ $actual == "$expect" ]]; } ||
{ expect=$(LC_ALL=C date) && actual=$(LC_ALL=C printf '%T\n' now) && [[ $actual == "$expect" ]]; } ||
err_exit 'printf "%T" now' "(expected $(printf %q "$expect"), got $(printf %q "$actual"))"
behead()
{
read line

View file

@ -54,7 +54,7 @@ static char* format[] =
"AM", "PM",
"GMT", "UTC", "UCT", "CUT",
"UTC", "UCT", "CUT", "GMT",
"DST", "", "", "",
@ -233,10 +233,10 @@ static Tm_leap_t leap[] =
static Tm_zone_t zone[] =
{
0, "GMT", 0, ( 0 * 60), 0, /* UTC */
0, "UCT", 0, ( 0 * 60), 0, /* UTC */
0, "UTC", 0, ( 0 * 60), 0, /* UTC */
0, "UCT", 0, ( 0 * 60), 0, /* UTC */
0, "CUT", 0, ( 0 * 60), 0, /* UTC */
0, "GMT", 0, ( 0 * 60), 0, /* UTC */
0, "Z", 0, ( 0 * 60), 0, /* UTC */
"USA", "HST", 0, (10 * 60), 0, /* Hawaii */
0, "YST", "YDT", ( 9 * 60), TM_DST, /* Yukon */