how to get timestamp in compile-time?

BCS none at
Tue Mar 23 13:06:59 PDT 2010

Hello Simen,

> On Tue, 23 Mar 2010 08:35:54 +0100, Zólyomi Istvan
> <istvan.zolyomi at> wrote:
>> Hi,
>> recently I've been experimenting with metaprogramming in D. I've been
>> trying to create a simple compiler benchmark that can be used like
>> the  following oversimplified code:
>> const time starttime = gettime();
>> mixin(code); // or any other metaprogramming activity (or even simple
>> code)
>> const time endtime = gettime();
>> pragma(msg, "Compiled in ", endtime - starttime);
>> It works fine with the exception of getting the current time.
>> Unfortunately, I've found no ctfe-capable library function to get the
>> time, and it turned out that special tokens like __TIME__ and its
>> kind  are evaluated once during compilation, so it always returns the
>> same  time for the same compilation unit.
>> Do you have any idea how to get the time in compile-time?
>> thanks
>> István
> Currently not possible, as far as I know.
> If you must, try instead to make a tiny program that launches DMD, and
> times its running time.

Or grab an existing one (*nix has 'time' for that).

... <IXOYE><

More information about the Digitalmars-d-learn mailing list