gpsd-dev
[Top][All Lists]
Advanced

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

Re: [gpsd-dev] Lots of warnings


From: Gary E. Miller
Subject: Re: [gpsd-dev] Lots of warnings
Date: Wed, 10 Aug 2016 12:42:18 -0700

Yo Joshua!

On Wed, 10 Aug 2016 09:45:54 -0400
Joshua Judson Rosen <address@hidden> wrote:

> On 08/09/2016 09:49 PM, Gary E. Miller wrote:
> >> timespec_str.c:48:12: warning: absolute value function 'labs' given
> >> an argument of type 'const time_t' (aka 'const long long') but has
> >> parameter of type 'long' which may cause truncation of value
> >> [-Wabsolute-value]   
> > 
> > Huh???  time_t is a long!  
> 
> Not according to that error-message, which says that it's a *long
> long* (like in the opening line of the song "American Pie", not in the
>  opening line of the Star Wars Episode IV).

Well, I can not duplicate that error message on any 32 bit system I have.

> In order to have a 64-bit time_t and escape the 2038 problem,
> wouldn't time_t have to be at least equivalent to "long long"
> on 32-bit platforms where "long" is still only 32 bits?

I just ran a test, on my Pi system:

pi2 ~ # gcc --version
gcc (Gentoo 4.9.3 p1.5, pie-0.6.4) 4.9.3

sizeof(time_t) = 4
sizeof(long) = 4
sizeof(long long) = 8

So 32 bit Pi is broken past 2038.

> I for example haven't had any desktops there were less than 64-bit
> for a while, but I still have *lots* of 32-bit embedded Linux
> devices--ranging from cheap routers to expensive robots.

Have you seen anywhere that time_t is > long?

In any case, I just changed my patch to use long long.  Now timespec_str()
is good to: Sat Nov 20 09:46:39 PST 2286

I sure wish printf() understood uint64_t.

As I side note, I just checked GNU "date".  It breaks on dates past
2038 on the Pi.

RGDS
GARY
---------------------------------------------------------------------------
Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97703
        address@hidden  Tel:+1 541 382 8588

Attachment: pgpqCnNHpPXhC.pgp
Description: OpenPGP digital signature


reply via email to

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