lua-users home
lua-l archive

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



You don't need any more than 32 bits until about 2100.
All you need is to look at time_t as an usigned 32bit value.


The way I handle this is with code like this:

if(time_32bit < -1) {
  time_64bit = time_32bit + 4294967296ULL;
} else {
  time_64bit = time_32bit;
}

This gives us a good time until 2100 or so (2108, actually). Converting time in to a normal year/month/day would require a big huge tine conversion library, but this gives us a usable UNIX timestamp for the next 80-88 years on 32-bit systems.

-- Sam