]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Apply timezone offset correctly
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 2 Dec 2021 17:08:42 +0000 (11:08 -0600)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 2 Dec 2021 17:15:11 +0000 (11:15 -0600)
src/lib/util/time.c

index df36cc9de48b8f6eaf7f909b155b616ae487452c..ebe13a9a0d280e0d9090b186e699133772e64a05 100644 (file)
@@ -668,7 +668,8 @@ fr_unix_time_t fr_unix_time_from_tm(struct tm *tm)
         *      2472692 adjusts the days for Unix epoch.  It is calculated as
         *      (365.2425 * (4800 + 1970))
         */
-       return fr_unix_time_from_sec((days - 2472692) * 86400 + (tm->tm_hour * 3600) + (tm->tm_min * 60) + tm->tm_sec + tm->tm_gmtoff);
+       return fr_unix_time_from_sec((((days - 2472692) * 86400) + (tm->tm_hour * 3600) +
+                                    (tm->tm_min * 60) + tm->tm_sec) - tm->tm_gmtoff);
 }
 
 /** Scale an input time to NSEC, clamping it at max / min.