Proposal for custom time string formatting in std.datetime

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Thu Dec 22 11:38:51 PST 2011


On 12/22/11 1:32 PM, Jonathan M Davis wrote:
[snip]

Now that we got to talk about std.datetime, here are three things that I 
think we could do to make it more manageable.

1. Put files in data. I find it a tad awkward that we have time zone 
information in hardcoded strings inside the code. That means any such 
change would have us redistributed Phobos. I'm thinking a small data 
file would be more appropriate. Better yet, hook into OSs timezone 
information and let the OS worry about keeping that timely.

2. datetime == time + date. We could reduce std.datetime to "public 
import std.time, std.date;" and define:

(a) std.time -> everything having to do with sheer time information, no 
date-related oddities. That means the largest formalized interval would 
be the week.

(b) std.date -> all of the bizarre calendar stuff, dealing with months 
and more. Naturally std.date would use std.time.

3. Using loops in unittest instead of rote repetition - this is already 
underway. We could actually use data files with unittests if that's helpful.


Andrei


More information about the Digitalmars-d mailing list