Don't reset DST computed by strptime() (when e.g. setting the

date via -f %s).

Reported by:	Eugene Grosbein
Diagnosed by:	Miguel Lopes Santos Ramos
This commit is contained in:
Ruslan Ermilov 2008-02-07 16:04:24 +00:00
parent e60a0104f8
commit a65550812a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=176094

View File

@ -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");