From 0ce4db6fd2bfb8142fc63219b892e000a4017541 Mon Sep 17 00:00:00 2001 From: millert Date: Mon, 15 Sep 2025 19:37:35 +0000 Subject: [PATCH] rcs_set_tz: Use timegm() to parse broken-down UTC We used to use mktime() (which expects local time not UTC) and manually adjust the time zone, but this did not take DST into account. From Tomas Rippl --- usr.bin/rcs/rcstime.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/usr.bin/rcs/rcstime.c b/usr.bin/rcs/rcstime.c index 1e886631402..ee2f8238632 100644 --- a/usr.bin/rcs/rcstime.c +++ b/usr.bin/rcs/rcstime.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rcstime.c,v 1.6 2016/08/26 09:02:54 guenther Exp $ */ +/* $OpenBSD: rcstime.c,v 1.7 2025/09/15 19:37:35 millert Exp $ */ /* * Copyright (c) 2006 Joris Vink * All rights reserved. @@ -42,9 +42,9 @@ rcs_set_tz(char *tz, struct rcs_delta *rdp, struct tm *tb) time_t now; if (!strcmp(tz, "LT")) { - now = mktime(&rdp->rd_date); + /* rd_date is stored in UTC, convert to local time. */ + now = timegm(&rdp->rd_date); ltb = localtime(&now); - ltb->tm_hour += ((int)ltb->tm_gmtoff/3600); memcpy(tb, ltb, sizeof(*tb)); } else { pos = 0;