Proposal for custom time string formatting in std.datetime

Stewart Gordon smjg_1998 at yahoo.com
Sat Dec 24 05:09:41 PST 2011


On 23/12/2011 21:24, Jonathan M Davis wrote:
<snip>
> It's not that I want to put %ctime and %mpeg7 in the same string. It's that I
> don't want to have to go define a function for every single one of them. It's a
> much smaller hit to the API to have flags for them.

So this is the principle of API design you go by - aim for one function 
that does everything? :)

OK, so if there's room for it in a given format string scheme, it 
doesn't really do any harm to have it.  But there's no point convoluting 
a scheme just to make room for named full-timestamp formats.

> Another alternative is to supply an enum of format strings for a variety of
> formats, though that also expands the API a bit (not as badly much though).

This seems to me a good idea.  It avoids implementation bloat, and these 
symbolic constants can be used just as they are or concatenated into the 
format string if you want to put something else there as well.

<snip>
> I don't want to shell out money for the spec if I don't have to. Even if I
> were willing to buy it, it's sold in 12 parts, and I'd probably end up buying
> several parts before I found the one with the definition of its time format,
> wasting that much more money. So, I'll have to go digging online again.

I've just discovered it on the ISO website.  It does seem an 
extortionate price for a spec.  Any idea where the money goes?

Stewart.


More information about the Digitalmars-d mailing list