+static int utc_offset() {\r
+ time_t ref = 24 * 60 * 60L;\r
+ struct tm * timeptr;\r
+ int gmtime_hours;\r
+\r
+ /* get the local reference time for Jan 2, 1900 00:00 UTC */\r
+ timeptr = localtime(&ref);\r
+ gmtime_hours = timeptr->tm_hour;\r
+\r
+ /* if the local time is the "day before" the UTC, subtract 24 hours\r
+ from the hours to get the UTC offset */\r
+ if (timeptr->tm_mday < 2) gmtime_hours -= 24;\r
+\r
+ return gmtime_hours;\r
+}\r
+\r
+time_t mktime_utc(struct tm *timeptr) {\r
+ return mktime(timeptr) + utc_offset() * 3600;\r
+}\r
+\r