Rant: Date and Time fall short of simplicity in D

Steven Schveighoffer schveiguy at yahoo.com
Fri Mar 29 19:50:16 PDT 2013


On Fri, 29 Mar 2013 19:35:35 -0400, Jonathan M Davis <jmdavisProg at gmx.com>  
wrote:

> On Friday, March 29, 2013 10:03:31 Steven Schveighoffer wrote:
>> 1. unixTimeToStdTime should take ulong.
>
> Why? You're converting a time_t, so unixToStdTime explicitly uses  
> time_t. Its
> size is system-dependent.

Because if your unix time is stored in a ulong, for whatever reason, you  
may then have to cast to call this function.

time_t implicitly casts to ulong, no matter the system-defined size of  
time_t.  It's also more future-proof, for dates past 2038.

Is there a specific reason to disallow accepting ulong?

-Steve


More information about the Digitalmars-d mailing list