Hi Tech,
I would like to suggest to use UTC functions on all date/time convertions, to avoid some clock drift errors.

Kind regards,
Alexandre Hamada

https://patch-diff.githubusercontent.com/raw/kristapsdz/rpki-client/pull/9.patch

From a463f8cb23375f15b74eff49a06e8934423e3dbf Mon Sep 17 00:00:00 2001
From: dev-gto <43351700+dev-...@users.noreply.github.com>
Date: Wed, 16 Oct 2019 07:22:46 -0300
Subject: [PATCH] Avoid local time conversion

---
 mft.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mft.c b/mft.c
index f9176b4..738f3ff 100644
--- a/mft.c
+++ b/mft.c
@@ -75,8 +75,8 @@ gentime2time(struct parse *p, const ASN1_GENERALIZEDTIME *tp)
        memset(&tm, 0, sizeof(struct tm));
        if (strptime(buf, "%b %d %T %Y %Z", &tm) == NULL)
                errx(EXIT_FAILURE, "%s: strptime", buf);
-       if ((t = mktime(&tm)) == -1)
-               errx(EXIT_FAILURE, "%s: mktime", buf);
+       if ((t = timegm(&tm)) == -1)
+               errx(EXIT_FAILURE, "%s: timegm", buf);
return t;
 }


Reply via email to