[patch] __TIMESTAMP__ predefined macro

H. J. Lu hjl@lucon.org
Wed Feb 15 15:04:00 GMT 2006


On Wed, Feb 15, 2006 at 06:54:00AM -0800, H. J. Lu wrote:
> On Wed, Feb 15, 2006 at 03:50:33PM +0100, Marcin Dalecki wrote:
> > 
> > On 2006-02-15, at 15:39, Andrew Pinski wrote:
> > >+	            sprintf ((char *)pbuffer->timestamp,
> > >+			        "\"%3s %3s %2d %02d:%02d:%02d %4d\"",
> > >+			        daynames[tb->tm_wday], 
> > >monthnames[tb->tm_mon],
> > >+			        tb->tm_mday, tb->tm_hour, tb->tm_min,
> > >+			        tb->tm_sec, tb->tm_year + 1900);
> > >
> > >
> > >Also why don't you just use ctime or asctime instead of spelling it  
> > >out?
> > >Considering ctime and asctim are C89, I would expect most targets  
> > >to define it anyways.
> > 
> > Compilation results at least shouldn't depend up on the systems  
> > locale setting
> > during compilation time. That would be rather annoying.
> 
> I don't like it either. Apparently, it is what MS is doing. Should we
> be different from the prior implemenation?

Did you mean "locale" or "local time"? MS uses local time. As for
locale, __TIMESTAMP__ is implemented similar to __DATE__ and __TIME__.
strftime can be used instead.


H.J.



More information about the Gcc-patches mailing list