time_t to simple date string conversion

Jonathan M Davis jmdavisProg at gmx.com
Tue Apr 5 15:52:06 PDT 2011


> On Tue, 05 Apr 2011 18:20:02 -0400, Jonathan M Davis <jmdavisProg at gmx.com>
> 
> wrote:
> > toSimpleString (which toString calls) does give the short version of the
> > month
> > in it, but during the review process, a number of the folks reviewing
> > it were
> > against putting code in there relating to printing the month out as a
> > name
> > rather than a number, because that gets it to dealing locales. The
> > result is
> > that the only stuff in std.datetime that does anything with the month's
> > name
> > as a string is toSimpleString (and therefore toString) and
> > fromSimpleString on
> > SysTime, Date, and DateTime. Everything else is numbers (though the
> > Month enum
> > does use the 3-letter English abbreviations for the names of its enum
> > values).
> > 
> > I wouldn't have minded having English-specific stuff in there with
> > locales
> > being dealt with elsewhere, but it essentially got pushed out entirely,
> > so
> > there's next to no English-specific stuff in there, and it will _all_ be
> > in
> > locale stuff, if we ever _do_ any locale stuff.
> 
> I think I was one of those who pushed not to have the names in there.  I
> couldn't remember whether it had stayed in or not, hence my non-committal
> statement :)
> 
> I agree with the way it is then.  We do need some sort of locale package.
> But judging from Tango's, it's not a small task.
> 
> Thanks for clarifying.
> 
> BTW, slightly OT, have you considered reworking datetime's docs to look
> more like Andrei's new std.algorithm?  There's an awful lot of links at
> the top of that page in non-related order.  I really think we need to work
> on DDoc so that it generates more useful pages.

What we really need is for ddoc to just generate proper links. And while what 
Andrei has done with std.algorithm really helps std.algorithm regardless of 
how well ddoc organizes its links, I don't think that the same type of thing 
would help std.datetime as much. The main problem with std.datetime's 
documentation is that it's primarily made up of structs and classes, and ddoc 
doesn't do anything special for structs or classes, so it just generates a big 
mess as far as the links go.

It may be worth adjusting std.datetime manually so that it generates properly 
organized links (similar to what Andrei has done with std.algorithm), but I'm 
in the midst of reworking the unit tests at present, so I don't know when I'd 
get around to it. I've been hoping that someone would finally come up with a 
proper fix for ddoc (some folks have done _some_ work in that area, but it 
obviously hasn't come to fruition yet). Assuming that ddoc were fixed, that 
would mostly solve std.datetime's problem, though perhaps some additional 
organization of the few free functions would still be of value.

In any case, I may work on improving std.datetime's links similar to what 
Andrei has done with std.algorithm, but I have other stuff to fix first.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list