[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [gpsd-dev] Lots of warnings
From: |
Greg Troxel |
Subject: |
Re: [gpsd-dev] Lots of warnings |
Date: |
Thu, 11 Aug 2016 20:30:34 -0400 |
User-agent: |
Gnus/5.130014 (Ma Gnus v0.14) Emacs/24.5 (berkeley-unix) |
"Gary E. Miller" <address@hidden> writes:
>> 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.
This kind of thing needs to be done by reading specs, not trying
particular systems. There are no guarantees on time_t other than that
it is a reasonable integer type.
>> 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.
On Linux/Pi; this is not about the hardware. time_t is int64_t on
NetBSD/Pi.
On NetBSD, time_t used to be long, like it was everywhere else, and in 6
was changed to int64_t. So regardless of CPU type, it's big enough.
I'm surprised this hasn't happened on the Linux/Pi system; 2038 is
starting to seem conceivable, now that 2000 is a distant memory.
>> 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?
NetBSD 6/7/current anything. I suspect FreeBSD and OpenBSD are the
same.
> 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.
It does; PRIu64. See int_fmtio.h, which I think implements format
specifiers from 7.8.1 of C99.
http://stackoverflow.com/questions/16859500/mmh-who-are-you-priu64
If gpsd doesn't require C99, things are much harder.
I would recommend casting to int64_t and using PRId64.
signature.asc
Description: PGP signature
- [gpsd-dev] Lots of warnings, Hal Murray, 2016/08/06
- Re: [gpsd-dev] Lots of warnings, Fred Wright, 2016/08/06
- Re: [gpsd-dev] Lots of warnings, Gary E. Miller, 2016/08/09
- Re: [gpsd-dev] Lots of warnings, Hal Murray, 2016/08/10
- Re: [gpsd-dev] Lots of warnings, Greg Troxel, 2016/08/10
- Re: [gpsd-dev] Lots of warnings, Joshua Judson Rosen, 2016/08/10
- Re: [gpsd-dev] Lots of warnings, Gary E. Miller, 2016/08/10
- Re: [gpsd-dev] Lots of warnings,
Greg Troxel <=
- Re: [gpsd-dev] Lots of warnings, Gary E. Miller, 2016/08/11
- Re: [gpsd-dev] Lots of warnings, Frank Nicholas, 2016/08/11
- Re: [gpsd-dev] Lots of warnings, Gary E. Miller, 2016/08/11
- Re: [gpsd-dev] Lots of warnings, Frank Nicholas, 2016/08/11
- Re: [gpsd-dev] Lots of warnings, Gary E. Miller, 2016/08/11
- Re: [gpsd-dev] Lots of warnings, Greg Troxel, 2016/08/12
- Re: [gpsd-dev] Lots of warnings, Gary E. Miller, 2016/08/12
- Re: [gpsd-dev] Lots of warnings, Joshua Judson Rosen, 2016/08/15
- Re: [gpsd-dev] Lots of warnings, Gary E. Miller, 2016/08/15
- Re: [gpsd-dev] Lots of warnings, Fred Wright, 2016/08/15