Skip to content

Conversation

@JackStouffer
Copy link
Contributor

See #5991 and #6060 for more details

@dlang-bot
Copy link
Contributor

Thanks for your pull request, @JackStouffer!

Bugzilla references

Auto-close Bugzilla Description
10828 datetime toString functions should accept sink

formattedWrite(writer, "%02d%02d%02d", _hour, _minute, _second);
catch (Exception e)
assert(0, "format() threw.");
assert(0, "formattedWrite() threw.");
Copy link
Contributor

Choose a reason for hiding this comment

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

Off-topic

FYI there's a trick to avoid the red coverage here - from dlang/druntime#2057 (comment):

scope (failure) assert(0, "formattedWrite() threw.");
formattedWrite(writer, "%02d%02d%02d", _hour, _minute, _second);

Also I wonder whether formattedWrite can be made nothrow when the input string is passed in at CTFE and thus checked at compile-time.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@wilzbach
Copy link
Contributor

BTW as you seem to be working on adding Writer support to std.datetime, there's core.time too and IIRC they all only have string toString.
For example, Duration - https://github.com/dlang/druntime/blob/594e3c66e0c0a38a4e8fa19cbfdf05601d7c0b3c/src/core/time.d#L1529

@dlang-bot dlang-bot merged commit dadb13d into dlang:master Jan 26, 2018
@JackStouffer JackStouffer deleted the timeofday-tostring branch January 27, 2018 05:27
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.

3 participants