Skip to contentSkip to conversation

debugfs, tune2fs: Handle daylight savings time when parsing a time string

PATCH New Theodore Ts'o 1 participant 1 message Mar 21, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 debugfs, tune2fs: Handle daylight savings time when parsing a time string

We need to set tm_isdst to -1 so that mktime will automatically determine whether or not daylight savings time (DST) is in effect. Previously tm_isdst was set to 0, which caused mktime to interpret the time as if it was always not using DST.

Addresses-Debian-Bug: #471882

---
 debugfs/util.c |    1 +
 misc/tune2fs.c |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)
debugfs/util.c +1 -0
index 0633960..ebce9d6 100644
@@ -231,6 +231,7 @@ extern time_t string_to_time(const char *arg)
 	    ts.tm_min > 59 || ts.tm_sec > 61)
 		ts.tm_mday = 0;
 #endif
+	ts.tm_isdst = -1;
 	ret = mktime(&ts);
 	if (ts.tm_mday == 0 || ret == ((time_t) -1)) {
 		/* Try it as an integer... */
misc/tune2fs.c +1 -0
index 4f66d42..4e731f5 100644
@@ -540,6 +540,7 @@ static time_t parse_time(char *str)
 			str);
 		usage();
 	}
+	ts.tm_isdst = -1;
 	return (mktime(&ts));
 }
 
Signature · 1 line
1.5.4.1.144.gdfee-dirty