gpsd-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gpsd-users] Build broken for non-QT


From: O'Connor, Daniel
Subject: [gpsd-users] Build broken for non-QT
Date: Tue, 13 Jan 2015 11:41:53 +1030

Commit fa02bd8b41017812302961f5c485d829d803437b has broken the non-QT build 
case (on FreeBSD anyway), i.e...
scons: done reading SConscript files.
scons: Building targets ...
cc -o gpsutils.os -c -D_GNU_SOURCE -Wmissing-prototypes -Wextra -Wall 
-Wno-uninitialized -Wno-missing-field-initializers -Wcast-align 
-Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith 
-Wreturn-type -pthread -Wmissing-declarations -g -O0 -pthread -fPIC gpsutils.c
gpsutils.c:355:39: error: use of undeclared identifier 'timezone'
    return (timestamp_t)mktime(&tm) - timezone + usec;
                                      ^
1 error generated.

AFAIK there is no truly portable way to do it but in practise you can use 
timegm to convert a struct tm to a UTC time_t.
diff --git a/gpsutils.c b/gpsutils.c
index 1564131..7dda32a 100644
--- a/gpsutils.c
+++ b/gpsutils.c
@@ -352,7 +352,7 @@ timestamp_t iso8601_to_unix( /address@hidden@*/ char 
*isotime)
        usec = strtod(dp, NULL);
     else
        usec = 0;
-    return (timestamp_t)mktime(&tm) - timezone + usec;
+    return (timestamp_t)timegm(&tm) + usec;
 #else
     double usec = 0;

--
Daniel O'Connor
"The nice thing about standards is that there
are so many of them to choose from."
 -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C




reply via email to

[Prev in Thread] Current Thread [Next in Thread]