On 04/07/2016 11:29 AM, Jonathan M Davis via Digitalmars-d-learn wrote:
On Thursday, April 07, 2016 07:45:06 yawniek via Digitalmars-d-learn wrote:
what is the way one is supposed to parse e.g. a
double of unixtime (as delived by nginx logs) into a SysTime?

currently i'm creating a wrapper struct around SysTime with alias
this as:

https://gist.github.com/yannick/6caf5a5184beea0c24f35d9d4a4c7783

really ugly imho.

is there a better way to do this?

Functions like format, to, etc. all use toString and constructors when
dealing with conversions to and from string. There is no way to provide a
custom conversion function for them to use with a type instead of what's
built into the type.

I think FormatSpec (and the undocumented FormatElement?) comes close:

  http://dlang.org/phobos/std_format.html#.FormatSpec

Ali

Reply via email to