Skip to content
Myr

strftime wrong day-of-week (fix #838)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by David Tolnay · committed by David Tolnay · parent e5dafae · Browse files · 2 files+16 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+16 added−1 removed

  • tests:+4 added−0 removed
  • other:+12 added−1 removed

2 files+16 added−1 removed

modified:tests/jq.test+4 added
1102 unmodified lines
1103strftime("%Y-%m-%dT%H:%M:%SZ")1104[2015,2,5,23,51,47,4,63]1105"2015-03-05T23:51:47Z"11061107strftime("%A, %B %e, %Y")11081435677542.8223511109"Tuesday, June 30, 2015"11101111gmtime111214255995071113[2015,2,5,23,51,47,4,63]1114
69 unmodified lines
modified:builtin.c+12 added-1 removed
1099 unmodified lines
11001101static int jv2tm(jv a, struct tm *tm) {1102 memset(tm, 0, sizeof(*tm));1103 TO_TM_FIELD(tm->tm_year, a, 0);1104 tm->tm_year -= 1900;1105 TO_TM_FIELD(tm->tm_mon, a, 1);1106 TO_TM_FIELD(tm->tm_mday, a, 2);1107 TO_TM_FIELD(tm->tm_hour, a, 3);1108 TO_TM_FIELD(tm->tm_min, a, 4);1109 TO_TM_FIELD(tm->tm_sec, a, 5);1109 tm->tm_year -= 1900;1110 TO_TM_FIELD(tm->tm_wday, a, 6);1111 TO_TM_FIELD(tm->tm_yday, a, 7);1112 jv_free(a);11131114 // We use UTC everywhere (gettimeofday, gmtime) and UTC does not do DST.1115 // Setting tm_isdst to 0 is done by the memset.1116 // tm->tm_isdst = 0;11171118 // The standard permits the tm structure to contain additional members. We1119 // hope it is okay to initialize them to zero, because the standard does not1120 // provide an alternative.11211122 return 1;1123}11241125#undef TO_TM_FIELD
554 unmodified lines