Skip to content

Fix it so that SysTime's from*String supports more than 7 digits.#5389

Merged
dlang-bot merged 1 commit intodlang:masterfrom
jmdavis:issue_16053
May 17, 2017
Merged

Fix it so that SysTime's from*String supports more than 7 digits.#5389
dlang-bot merged 1 commit intodlang:masterfrom
jmdavis:issue_16053

Conversation

@jmdavis
Copy link
Member

@jmdavis jmdavis commented May 13, 2017

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).

…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).
@dlang-bot
Copy link
Contributor

Fix Bugzilla Description
16053 SysTime.fromIsoExtString don't work if nanoseconds are presented

Copy link
Contributor

@wilzbach wilzbach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM as well - it seems we still have the issues with the Project Tester. @CyberShadow could you disable it from the required CIs as long as Martin isn't reachable, s.t. PRs aren't unnecessarily blocked?

@CyberShadow
Copy link
Member

@CyberShadow could you disable it from the required CIs as long as Martin isn't reachable, s.t. PRs aren't unnecessarily blocked?

Done

@dlang-bot dlang-bot merged commit 2a0560e into dlang:master May 17, 2017
@jmdavis jmdavis deleted the issue_16053 branch May 18, 2017 09:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants