Переглянути джерело

README.md: more timegm() documentation

Kosma Moczek 11 роки тому
батько
коміт
23e2f950c5
2 змінених файлів з 4 додано та 3 видалено
  1. 3 2
      README.md
  2. 1 1
      minmea.c

+ 3 - 2
README.md

@@ -124,8 +124,9 @@ typing ``make``.
   a workaround, use the ``-ffunction-sections -Wl,--gc-sections`` linker flags
   (or equivalent) to remove the unused functions (parsers) from the final image.
 * Some systems lack ``timegm``. On these systems, the recommended course of
-  action is to build with ``-Dtimegm=mktime`` - assuming the system runs in the
-  default ``UTC`` timezone.
+  action is to build with ``-Dtimegm=mktime`` which will work correctly as long
+  the system runs in the default ``UTC`` timezone. Native Windows builds should
+  use ``-Dtimegm=_mkgmtime`` instead which will work correctly in all timezones.
 
 ## Bugs
 

+ 1 - 1
minmea.c

@@ -531,7 +531,7 @@ int minmea_gettimeofday(struct timeval *tv, const struct minmea_date *date, cons
     tm.tm_min = time_->minutes;
     tm.tm_sec = time_->seconds;
 
-    time_t timestamp = timegm(&tm);
+    time_t timestamp = timegm(&tm); /* See README.md if your system lacks timegm(). */
     if (timestamp != -1) {
         tv->tv_sec = timestamp;
         tv->tv_usec = time_->microseconds;