gpsd-users
[Top][All Lists]
Advanced

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

Re: [gpsd-users] Build broken for non-QT


From: Eric S. Raymond
Subject: Re: [gpsd-users] Build broken for non-QT
Date: Tue, 13 Jan 2015 05:28:50 -0500
User-agent: Mutt/1.5.23 (2014-03-12)

O'Connor, Daniel <address@hidden>:
> 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;

That patch would reintroduce a glibc dependency, which we're trying to avoid.

The timezone global is an ugly but standardized feature of the POSIX/SuS API,
supposed to be set after tzset(3).  Does FreeBSD really not have it?  Perhaps
there's a feature macro you need to enable.
-- 
                <a href="http://www.catb.org/~esr/";>Eric S. Raymond</a>



reply via email to

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