NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: lib/49180: date -r cuts off a few seconds early
The following reply was made to PR lib/49180; it has been noted by GNATS.
From: David Holland <dholland-bugs%netbsd.org@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc:
Subject: Re: lib/49180: date -r cuts off a few seconds early
Date: Thu, 11 Sep 2014 19:01:12 +0000
On Sun, Sep 07, 2014 at 12:05:01PM +0000, martin%NetBSD.org@localhost wrote:
> Trying to print out the UTC date of the last seconds representable with
> our 64 bit signed time_t fails.
>
> >How-To-Repeat:
> Try: date -u -r 922337206854775806
> and watch: date: 922337206854775806: localtime: Value too large to be
stored in data type
> (which is incorrect, it is: 0x7ffffffffffffffe)
>
> Strangely a simple C program doing the same strtoll() call seems to work
> fine for me.
That's because when it says "localtime:" it isn't just blowing smoke.
It's not strtoll that's failing.
Searching to find the last value that works shows the problem:
valkyrie% date -u -r 67767976233532799
Tue Dec 31 23:59:59 UTC 2147483647
^^^^^^^^^^
--
David A. Holland
dholland%netbsd.org@localhost
Home |
Main Index |
Thread Index |
Old Index