diff --git a/src/builtin.c b/src/builtin.c index 1c6b08cd4d..3c57152634 100644 --- a/src/builtin.c +++ b/src/builtin.c @@ -1239,7 +1239,8 @@ static jv tm2jv(struct tm *tm) { jv_number(tm->tm_min), jv_number(tm->tm_sec), jv_number(tm->tm_wday), - jv_number(tm->tm_yday)); + jv_number(tm->tm_yday), + jv_number(tm->tm_isdst)); } #if defined(WIN32) && !defined(HAVE_SETENV) @@ -1460,12 +1461,9 @@ static int jv2tm(jv a, struct tm *tm) { TO_TM_FIELD(tm->tm_sec, a, 5); TO_TM_FIELD(tm->tm_wday, a, 6); TO_TM_FIELD(tm->tm_yday, a, 7); + TO_TM_FIELD(tm->tm_isdst, a, 8); jv_free(a); - // We use UTC everywhere (gettimeofday, gmtime) and UTC does not do DST. - // Setting tm_isdst to 0 is done by the memset. - // tm->tm_isdst = 0; - // The standard permits the tm structure to contain additional members. We // hope it is okay to initialize them to zero, because the standard does not // provide an alternative. diff --git a/tests/jq.test b/tests/jq.test index 2d5c36b887..dc62981a35 100644 --- a/tests/jq.test +++ b/tests/jq.test @@ -1440,7 +1440,7 @@ bsearch(0,2,4) # strptime tests are in optional.test strftime("%Y-%m-%dT%H:%M:%SZ") -[2015,2,5,23,51,47,4,63] +[2015,2,5,23,51,47,4,63,0] "2015-03-05T23:51:47Z" strftime("%A, %B %d, %Y") @@ -1449,7 +1449,7 @@ strftime("%A, %B %d, %Y") gmtime 1425599507 -[2015,2,5,23,51,47,4,63] +[2015,2,5,23,51,47,4,63,0] # module system import "a" as foo; import "b" as bar; def fooa: foo::a; [fooa, bar::a, bar::b, foo::a] diff --git a/tests/man.test b/tests/man.test index 2a49effe6c..1ec3283bff 100644 --- a/tests/man.test +++ b/tests/man.test @@ -645,7 +645,7 @@ fromdate strptime("%Y-%m-%dT%H:%M:%SZ") "2015-03-05T23:51:47Z" -[2015,2,5,23,51,47,4,63] +[2015,2,5,23,51,47,4,63,0] strptime("%Y-%m-%dT%H:%M:%SZ")|mktime "2015-03-05T23:51:47Z" diff --git a/tests/optional.test b/tests/optional.test index 85bc9e9941..0116a0e8af 100644 --- a/tests/optional.test +++ b/tests/optional.test @@ -3,14 +3,14 @@ # strptime() is not available on mingw/WIN32 [strptime("%Y-%m-%dT%H:%M:%SZ")|(.,mktime)] "2015-03-05T23:51:47Z" -[[2015,2,5,23,51,47,4,63],1425599507] +[[2015,2,5,23,51,47,4,63,0],1425599507] # Check day-of-week and day of year computations # (should trip an assert if this fails) # This date range last(range(365 * 67)|("1970-03-01T01:02:03Z"|strptime("%Y-%m-%dT%H:%M:%SZ")|mktime) + (86400 * .)|strftime("%Y-%m-%dT%H:%M:%SZ")|strptime("%Y-%m-%dT%H:%M:%SZ")) null -[2037,1,11,1,2,3,3,41] +[2037,1,11,1,2,3,3,41,0] # %e is not available on mingw/WIN32 strftime("%A, %B %e, %Y")