Deal with strptime() on OS X and *BSD (fix #1415)
strptime() on OS X and *BSDs (reputedly) does not set tm_wday and tm_yday unless corresponding %U and %j format specifiers were used. That can be... surprising when one parsed year, month, and day anyways. Glibc's strptime() conveniently sets tm_wday and tm_yday in those cases, but OS X's does not, ignoring them completely. This commit makes jq compute those where possible, though the day of week computation may be wrong for dates before 1900-03-01 or after 2099-12-31.
This commit is contained in:
1 parent
4a6241be06
commit
c538237f4e
4 files changed
+83
-10
No files matched your search
@@ -1908,9 +1908,11 @@ sections:
|
||||
Unix epoch and outputs a "broken down time" representation of
|
||||
Greenwhich Meridian time as an array of numbers representing
|
||||
(in this order): the year, the month (zero-based), the day of
|
||||
the month, the hour of the day, the minute of the hour, the
|
||||
second of the minute, the day of the week, and the day of the
|
||||
year -- all one-based unless otherwise stated.
|
||||
the month (one-based), the hour of the day, the minute of the
|
||||
hour, the second of the minute, the day of the week, and the
|
||||
day of the year -- all one-based unless otherwise stated. The
|
||||
day of the week number may be wrong on some systems for dates
|
||||
before March 1st 1900, or after December 31 2099.
|
||||
|
||||
The `localtime` builtin works like the `gmtime` builtin, but
|
||||
using the local timezone setting.
|
||||
|
||||
Reference in new issue
Block a user