[Issue 16053] SysTime.fromIsoExtString don't work if nanoseconds are presented

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue May 16 20:13:14 PDT 2017


https://issues.dlang.org/show_bug.cgi?id=16053

--- Comment #3 from github-bugzilla at puremagic.com ---
Commit pushed to master at https://github.com/dlang/phobos

https://github.com/dlang/phobos/commit/21c09f18d33b65475a89c7d6ec75d87556e6c1e5
Issue 16053: Fix it so that SysTime's from*String supports more than 7 digits.

ISO 8601 says that it's up to the application to decide how many digits
to put in the fractional seconds if they're present. SysTime.to*String
puts up to 7 (stripping trailing zeroes), because that's
hecto-nanosecond precision, and SysTime holds the time in
hecto-nanoseconds. Currently, from*String only accepts up to 7 digits in
the fractional seconds, which _does_ follow the spec in that (per the
spec) the number of digits is up to the applications. However, while we
never emit more than 7 digits, other applications do, so only accepting
7 digits makes us incompatible with them, whereas accepting them would
make us more compatible with other programs, and it would actually be
more efficient, since we'd have fewer checks in the code.

So, these changes make is so that SysTime.from*String accepts more than 7
digits in the fractional seconds, but the additional digits are
truncated (since SysTime doesn't support more than 7 digits of
precision).

--


More information about the Digitalmars-d-bugs mailing list