d_time and writefln

Regan Heath regan at netwin.co.nz
Tue May 9 14:26:21 PDT 2006


On Tue, 09 May 2006 09:47:59 -0500, Carlos Santander  
<csantander619 at gmail.com> wrote:
> Stewart Gordon escribió:
>> Chris Nicholson-Sauls wrote:
>> <snip>
>>> The problem is, that 'd_time' is just an alias of long, so writef*()  
>>> just sees it as a long.  Maybe d_time could be typedef'd to change  
>>> this, but would that break anything?  If it has no or few cons against  
>>> it, I'm cool with typedef'ing it, although it would couple std.format  
>>> and std.date to each other a little.
>
> Another solution would be to add a bit of type information to aliases.  
> In any case, if d_time is the official way to deal with dates and times  
> in D, I wouldn't be surprised if many people new to D tried to do
>
> writefln(getUTCtime());
>
> So, regardless of the solution, I believe printing the numeric  
> representation is wrong.

It should remain possible to print the numeric representation. For use in  
files/records/etc on disk or otherwise. I use the numeric time_t value  
 from time() in C/C++ all the time. It's far easier to read/write a number  
than parse a string which could be in many different formats.

Regan



More information about the Digitalmars-d-bugs mailing list