www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Why unix time is signed

From wiki:

There was originally some controversy over whether the Unix time_t should be
signed or unsigned. If unsigned, its range in the future would be doubled,
postponing the 32-bit overflow (by 68 years). However, it would then be
incapable of representing times prior to 1970. Dennis Ritchie, when asked about
this issue, said that he hadn't thought very deeply about it, but was of the
opinion that the ability to represent all times within his lifetime would be

consensus is for time_t to be signed, and this is the usual practice. The
software development platform for version 6 of the QNX operating system has an
unsigned 32-bit time_t, though older releases used a signed type.
In some newer operating systems, time_t has been widened to 64 bits. In the
negative direction, this goes back more than twenty times the age of the
universe, and so suffices. In the positive direction, whether the approximately
293 billion representable years is truly sufficient depends on the ultimate
fate of the universe, but it is certainly adequate for most practical purposes.
This is a good example when one wants to represent big numbers, he doesn't use usigned type, he uses signed 64-bit type.
Nov 17 2010