Skip to content

Commit

Permalink
Update to logger due to fracSec deprecation in std.datetime.
Browse files Browse the repository at this point in the history
I also fixed it so that it casts to DateTime rather than calling all of
the various properties on SysTime individually, since that's more or
less equivalent to casting to DateTime and getting the property off of
it for each call. I probably never should have put those properties on
SysTime in the first place, though it is more user-friendly in the cases
where you don't care about efficiency. I expect that we _do_ care about
efficiency in the logger however.
  • Loading branch information
jmdavis committed Aug 30, 2015
1 parent 7b4abd0 commit f3af4ca
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions std/experimental/logger/core.d
Expand Up @@ -168,16 +168,17 @@ private string parentOf(string mod)
/* This function formates a $(D SysTime) into an $(D OutputRange).
The $(D SysTime) is formatted similar to
$(LREF std.datatime.DateTime.toISOExtString) expect the fractional second part.
The sub second part is the upper three digest of the microsecond.
$(LREF std.datatime.DateTime.toISOExtString) except the fractional second part.
The fractional second part is in milliseconds and is always 3 digits.
*/
void systimeToISOString(OutputRange)(OutputRange o, const ref SysTime time)
if (isOutputRange!(OutputRange,string))
{
auto fsec = time.fracSec.usecs / 1000;
const auto dt = cast(DateTime)time;
const auto fsec = time.fracSecs.total!"msecs";

formattedWrite(o, "%04d-%02d-%02dT%02d:%02d:%02d.%03d",
time.year, time.month, time.day, time.hour, time.minute, time.second,
dt.year, dt.month, dt.day, dt.hour, dt.minute, dt.second,
fsec);
}

Expand Down

0 comments on commit f3af4ca

Please sign in to comment.