Rant: Date and Time fall short of simplicity in D

Jonathan M Davis jmdavisProg at gmx.com
Sun Mar 31 18:41:04 PDT 2013


On Saturday, March 30, 2013 22:39:49 Steven Schveighoffer wrote:
> What C stuff am I interacting with?  Unix Time <=> SysTime conversions are
> purely D code.

If you're using pure D code, then why are you using unix time at all? I would 
expect the need for unix time in pure D code to be extremely rare. Pretty much 
the whole reason that unix time is supported in the first place is because 
that's what C uses. If we'd never had to worry about C, then there shouldn't 
have been much need for it.

> It won't be very long until Unix will have to tackle this (hopefully they
> don't wait until 2037).  The most likely scenario is they just increase
> the bits for time_t to 64. 

As I understand it, that _is_ the solution. Most everything is moving to 64-
bit anyway.

> D will be more ready for that with a change to
> long/ulong for unixTimeToSysTime.

We're ready for that already with time_t. If time_t isn't 64-bit on your 
system when 2038 comes, you're screwed anyway as long as you're dealing with 
time_t.

I'm not completely against changing what unixTimeToSysTime takes, but unix 
time is very much tied to time_t, and I really don't buy that it buys us much 
to make it take a long.

- Jonathan M Davis


More information about the Digitalmars-d mailing list