mirror of
https://github.com/johnkerl/miller.git
synced 2026-01-23 18:25:45 +00:00
When parsing a timestamp-string into epoch seconds, first we use strptime to get a `struct tm` of year, month, day, etc, but strptime is timezone-naive and doesn't set tm_isdst meaningfully (glibc apparently doesn't set it at all). Then we ask mktime() to convert a `struct tm` to epoch seconds, and we can ask it to lookup DST status for the current timezone by giving it a `struct tm` with tm_isdst set to a negative value. See the mktime(3) manpage. With this change, strptime_local and localtime2sec agree with how GNU `date` parses timestamp-strings, with the exception that `date` refuses to parse ambiguous timestamp-strings that fall within the "fold" intervals of DST transitions, saying they're invalid. Since `date` uses additional libraries to give good timezone support it's capable of detecting these ambiguous timestamp-strings, but for a tool like miller it's reasonable to rely directly on libc and have it choose an epoch-seconds-timestamp that correspond to either the first or second time-of-day that the timestamp-string represents. Remove a duplicate test from c/reg_test/run. Fix #170 |
||
|---|---|---|
| .. | ||
| context.c | ||
| context.h | ||
| free_flags.h | ||
| Makefile.am | ||
| Makefile.in | ||
| minunit.h | ||
| mlr_arch.c | ||
| mlr_arch.h | ||
| mlr_globals.c | ||
| mlr_globals.h | ||
| mlr_test_util.c | ||
| mlr_test_util.h | ||
| mlrdatetime.c | ||
| mlrdatetime.h | ||
| mlrescape.c | ||
| mlrescape.h | ||
| mlrmath.c | ||
| mlrmath.h | ||
| mlrregex.c | ||
| mlrregex.h | ||
| mlrstat.c | ||
| mlrstat.h | ||
| mlrtimezone.h | ||
| mlrutil.c | ||
| mlrutil.h | ||
| mlrval.c | ||
| mlrval.h | ||
| mtrand.c | ||
| mtrand.h | ||
| mvfuncs.c | ||
| mvfuncs.h | ||
| netbsd_strptime.c | ||
| netbsd_strptime.h | ||
| nlnet_timegm.c | ||
| nlnet_timegm.h | ||
| string_array.c | ||
| string_array.h | ||
| string_builder.c | ||
| string_builder.h | ||
| utf8.h | ||