[Issue 21507] SysTime.toISOExtString is unusable for logging or consistent filename creation
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Sep 29 11:32:46 UTC 2021
https://issues.dlang.org/show_bug.cgi?id=21507
--- Comment #2 from anonymous4 <dfj1esp02 at sneakemail.com> ---
You don't need to parse it, you can just append zeros:
---
string want(string time, int num)
{
string tail=".000000000";
time=time[0..$-1];
if(num==0)return time[0..19];
if(time.length>=20+num)return time[0..20+num];
if(time.length>20) //1001-01-01T01:01:01Z
return time~tail[$-(20+num-time.length)..$];
return time~tail[0..num+1];
}
---
--
More information about the Digitalmars-d-bugs
mailing list