ttime zone fix - plan9port - [fork] Plan 9 from user space
(HTM) git clone git://src.adamsgaard.dk/plan9port
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 6452f95be69efb9ce54158b3ddb9c7c3797e652f
(DIR) parent e0d1df6f7cef193774518a690ef9cbdebbdd0c4b
(HTM) Author: rsc <devnull@localhost>
Date: Thu, 18 May 2006 23:08:02 +0000
ttime zone fix
Diffstat:
M src/lib9/date.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
---
(DIR) diff --git a/src/lib9/date.c b/src/lib9/date.c
t@@ -44,7 +44,11 @@ tm2Tm(struct tm *tm, Tm *bigtm, int gmt)
static void
Tm2tm(Tm *bigtm, struct tm *tm)
{
- memset(tm, 0, sizeof *tm);
+ /* initialize with current time to get local time zone! (tm_isdst) */
+ time_t t;
+ time(&t);
+ *tm = *localtime(&t);
+
tm->tm_sec = bigtm->sec;
tm->tm_min = bigtm->min;
tm->tm_hour = bigtm->hour;