summary refs log tree commit diff
path: root/handle.c
diff options
context:
space:
mode:
authorC. McEnroe2020-02-03 18:41:52 -0500
committerC. McEnroe2020-02-03 18:41:52 -0500
commit26e9dd9adfd4df90cd4cc6ef14d91cdad2efb239 (patch)
tree6c4a44b69dae6be1fa75395fe23cd735669c5462 /handle.c
parentc9470b59a151f639e7985ca545bd67182e7a88d8 (diff)
Use time_t rather than struct tm
Diffstat (limited to 'handle.c')
-rw-r--r--handle.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/handle.c b/handle.c
index 4bc2e3d..ef49f7c 100644
--- a/handle.c
+++ b/handle.c
@@ -71,12 +71,13 @@ static void require(struct Message *msg, bool origin, size_t len) {
 	}
 }
 
-static const struct tm *tagTime(const struct Message *msg) {
+static const time_t *tagTime(const struct Message *msg) {
+	static time_t time;
+	struct tm tm;
 	if (!msg->tags[TagTime]) return NULL;
-	static struct tm time;
-	char *rest = strptime(msg->tags[TagTime], "%FT%T", &time);
-	time.tm_gmtoff = 0;
-	return (rest ? &time : NULL);
+	if (!strptime(msg->tags[TagTime], "%FT%T", &tm)) return NULL;
+	time = timegm(&tm);
+	return &time;
 }
 
 typedef void Handler(struct Message *msg);