diff options
author | Jakob Kaivo <jkk@ung.org> | 2020-08-15 10:49:48 -0400 |
---|---|---|
committer | Jakob Kaivo <jkk@ung.org> | 2020-08-15 10:49:48 -0400 |
commit | e12e649d8449e7b18764381458162d80bdd80b09 (patch) | |
tree | d83c19c45ef58a67f77d0e959931b7a1de19f9ad /src/time/tzset.c | |
parent | b363e1cae190e2f64f28694d5cc63c774c370a36 (diff) |
rough outline
Diffstat (limited to 'src/time/tzset.c')
-rw-r--r-- | src/time/tzset.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/time/tzset.c b/src/time/tzset.c index 51afb285..ad83b9e1 100644 --- a/src/time/tzset.c +++ b/src/time/tzset.c @@ -1,7 +1,42 @@ #include <time.h> +#include <stdlib.h> +#include <string.h> +#include "_time.h" + void tzset(void) { + char buf[TZNAMELEN * 3]; /* one for std, one for dst, plus dst rule */ + char *tzstr = getenv("TZ"); + if (tzstr == NULL) { + tzstr = "UTC0"; + } + + if (strlen(tzstr) > sizeof(buf)) { + return; + } + + tzname[0] = __time.stdtz; + tzname[1] = __time.dsttz; + strcpy(tzname[0], tzstr); + + /* TODO: + no spaces in actual string + + stdname hh[:mm[:ss]] [dstname [hh[:mm[:ss]]] [,start[/time],end[/time]] + + stdname and dstname are either + all isalpha() + '<' [[:alnum:]+-]* '>' + + hh may be prefixed by + or - + */ + + #ifdef _XOPEN_SOURCE + /* TODO */ + daylight = 0; + #endif } + /* POSIX(1) */ |