shithub: npe

Download patch

ref: 73101d7c240331253c4b80b04520dc118dd8e679
parent: 7a8cd4cb0b312e13a88d4d3175a839a2536ee4e3
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Mon Jul 10 10:58:13 EDT 2023

time funcs: set timezone

--- a/include/npe/time.h
+++ b/include/npe/time.h
@@ -15,6 +15,7 @@
 	int tm_wday;
 	int tm_yday;
 	int tm_isdst;
+	char *tm_zone;
 };
 
 #include <sys/time.h>
--- a/libnpe/gmtime.c
+++ b/libnpe/gmtime.c
@@ -21,6 +21,7 @@
 		tm.tm_wday = t->wday;
 		tm.tm_yday = t->yday;
 		tm.tm_isdst = 0; /* FIXME */
+		tm.tm_zone = "GMT";
 	}
 
 	return &tm;
--- a/libnpe/localtime.c
+++ b/libnpe/localtime.c
@@ -21,6 +21,7 @@
 		tm.tm_wday = t->wday;
 		tm.tm_yday = t->yday;
 		tm.tm_isdst = 0; /* FIXME */
+		tm.tm_zone = "local";
 	}
 
 	return &tm;
--- a/libnpe/mktime.c
+++ b/libnpe/mktime.c
@@ -15,7 +15,7 @@
 	t.wday = tm->tm_wday;
 	t.yday = tm->tm_yday;
 	t.tzoff = 0;
-	t.tz = nil;
+	t.tz = tzload(tm->tm_zone);
 	/* ... = tm.tm_isdst; */ /* FIXME */
 
 	return tmnorm(&t) / Nsec;