diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2016-10-23 14:55:05 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2016-10-23 14:55:05 -0700 |
commit | fbbdb0a37edf93b93bc030e9136bf24caf899c9f (patch) | |
tree | 72d6e0526b38d5e5c740337849c622eb5cf54717 /lib.c | |
parent | 5499e1c24c2bc7a347cbe9dc10c62bc0df06be76 (diff) | |
download | txr-fbbdb0a37edf93b93bc030e9136bf24caf899c9f.tar.gz txr-fbbdb0a37edf93b93bc030e9136bf24caf899c9f.tar.bz2 txr-fbbdb0a37edf93b93bc030e9136bf24caf899c9f.zip |
Default to epoch time in time-parse.
* lib.c (epoch_time): New static function.
(time_parse): Default the struct tm to epoch.
* txr.1: Documented.
Diffstat (limited to 'lib.c')
-rw-r--r-- | lib.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -9770,9 +9770,17 @@ val make_time(val year, val month, val day, #if HAVE_STRPTIME +static struct tm epoch_tm(void) +{ + struct tm ep = { 0 }; + ep.tm_year = 70; + ep.tm_mday = 1; + return ep; +} + val time_parse(val format, val string) { - struct tm tms = { 0 }; + struct tm tms = epoch_tm(); const wchar_t *w_str = c_str(string); const wchar_t *w_fmt = c_str(format); char *str = utf8_dup_to(w_str); |