Time from timestamp?
ketmar via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Jan 30 15:49:42 PST 2015
On Sat, 31 Jan 2015 12:12:08 +1300, Rikki Cattermole wrote:
> On 31/01/2015 12:06 p.m., ketmar wrote:
>> On Fri, 30 Jan 2015 22:38:20 +0000, Chris Williams wrote:
>>
>>> Unix timestamps can be negative
>> WUT?! O_O
>
> Looks like we are both thinking the usual case.
>
> The standard Unix time_t (data type representing a point in time) is a
> signed integer data type, traditionally of 32 bits (but see below),
> directly encoding the Unix time number as described in the preceding
> section. Being 32 bits means that it covers a range of about 136 years
> in total. The minimum representable time is 1901-12-13, and the maximum
> representable time is 2038-01-19. The second after 03:14:07 UTC
> 2038-01-19 this representation overflows. This milestone is anticipated
> with a mixture of amusement and dread; see year 2038 problem.
>
> From wikipedia.
>
> https://github.com/D-Programming-Language/druntime/blob/master/src/core/
stdc/time.d#L68
>
> Looks like I got to modify it.
nobody ever planned "negative timestamps". using signed time_t was just a
design error (nobody cares at the time). unix timestamps are timestamps
for things created in unix. i can't imagine how you can create something
BEFORE the unix itself (hence 1970 as a starting point -- with some gap
to allow older files).
there is no such thing as "negative timestamp", any negative timestamp is
a bug.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20150130/4e1e1763/attachment-0001.sig>
More information about the Digitalmars-d-learn
mailing list