Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chronat: Add year and year_month_day formatting #1840
chronat: Add year and year_month_day formatting #1840
Changes from all commits
e6708c5
8ec251d
84e7c61
99f656d
8d47d50
5722065
c89a21e
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if the specifiers that are valid for
weekday
are also valid here since a specific year, month, and weekday would give us a particular weekday. Similarly, would'U'
and'V'
be valid specifiers since we could get a particular week from ayear_month_day
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do not have a weekday. I based which specifiers are legal from put_time, and since it isn't trivial to compute the weekday from just a year/month/day, I think it doesn't apply. I could be very wrong though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After discussing on discord, I agree it makes sense to be able to derive some more information from a
year_month_day
than I originally implemented.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you want to just populate this with all of the type specifiers that will end up here? Or were you planning to add to this as we added
formatter
s/operator<<
s for each type? I think we'll also need to include%c
,%x
,%X
looking at Table 101.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I think we need to rename this function. It was conceived as a way to figure out specifiers can throw, so we can explicit about
ok()
checking.%c
uses locale, but I don't think it can ever be out of bounds. Maybe_Type_needs_bounds_checking
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think
%c
will actually require more extensive bounds-checking becauseput_time
[says that%c
uses all fields oftm
so there is even more opportunity for out-of-bounds issues?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to say that
%c
is used for a point in time, measured from some base. You can't have an invalid seconds, because you derive the seconds from the amount of time elapsed.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm trying to work out what type would be used to format
%c
and I think it would probably betime_point
s right? (e.g.,sys_time
, etc.). If we would just usetime_point::time_since_epoch()
then I think you're right.