[dmd-internals] How important are the exact formats of __DATE__, __TIME__, and __TIMESTAMP___?

Jacob Carlborg doob at me.com
Wed Mar 9 09:28:50 PST 2011


Doesn't std.datetime have function for easily formatting dates and times?

-- 
/Jacob Carlborg

On 9 mar 2011, at 04:36, Jonathan M Davis wrote:

> Do they _have_ to be in a particular format? I ask because I've slowly been 
> going through the lexer code, translating it to D for std.lang.d.lex, and I'm 
> very tempted to just use std.datetime to produce the values for __DATE__, 
> __TIME__, __TIMESTAMP__. The resulting values would look cleaner IMHO, and the 
> code would be simpler. However, that _would_ result in a slightly different 
> format for __DATE__ and __TIMESTAMP__.
> 
> Honestly, I didn't even know that these "macros" existed before I ran into them 
> in the lexer - there's no mention of them on the site as far as I can determine. 
> So, I have no idea whether they're exact format is considered important and part 
> of the spec or not. If the format _is_ important, then I might as well leave it 
> and have the D code call time and ctime as it does in the C++ code, but I'd just 
> as soon use std.datetime if the format doesn't have to be absolutely exact.
> 
> So, are the formats of __DATE__, __TIME__, and __TIMESTAMP__ exact such that 
> they should _always_ be as they currently are in the C++ lexer, or are they 
> flexible enough that I can just simplify the code in the D lexer with 
> std.datetime?
> 
> - Jonathan M Davis
> _______________________________________________
> dmd-internals mailing list
> dmd-internals at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/dmd-internals



More information about the dmd-internals mailing list