diff options
Diffstat (limited to 'bin/date/date.c')
-rw-r--r-- | bin/date/date.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/bin/date/date.c b/bin/date/date.c index be296a1f3b34..578229eb4308 100644 --- a/bin/date/date.c +++ b/bin/date/date.c @@ -186,8 +186,10 @@ setthetime(const char *fmt, const char *p, int jflag, int nflag) const char *dot, *t; int century; + lt = localtime(&tval); + lt->tm_isdst = -1; /* divine correct DST */ + if (fmt != NULL) { - lt = localtime(&tval); t = strptime(p, fmt, lt); if (t == NULL) { fprintf(stderr, "Failed conversion of ``%s''" @@ -208,8 +210,6 @@ setthetime(const char *fmt, const char *p, int jflag, int nflag) badformat(); } - lt = localtime(&tval); - if (dot != NULL) { /* .ss */ dot++; /* *dot++ = '\0'; */ if (strlen(dot) != 2) @@ -264,9 +264,6 @@ setthetime(const char *fmt, const char *p, int jflag, int nflag) } } - /* Let mktime() decide whether summer time is in effect. */ - lt->tm_isdst = -1; - /* convert broken-down time to GMT clock time */ if ((tval = mktime(lt)) == -1) errx(1, "nonexistent time"); |