-
Notifications
You must be signed in to change notification settings - Fork 95
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
to_iso_extended_string documentation wrong about fraction print #110
Comments
The docs are ‘right’, but incomplete. If the fractional seconds are 0 then it is omitted - that’s probably the report your receiving. I have a version if the function around somewhere that consistently prints the fractional second even when zero.
… On Oct 10, 2019, at 5:44 AM, Markus Klemm ***@***.***> wrote:
I am using std::string to_iso_extended_string(ptime) and have reports that on some system it prints without the second fractions. Consulting the documentation and the header of boost 1.71 I was confronted with inconsistent documentation:
The Docs are saying it prints with fractions of a second:
std::string to_iso_extended_string(ptime)
Convert to form YYYY-MM-DDTHH:MM:SS,fffffffff where T is the date-time separator
2002-01-31T10:00:01,123456789
While the accoding header says:
//! Convert to form YYYY-MM-DDTHH:MM:SS where T is the date-time separator
/*!\ingroup time_format
*/
inline std::string to_iso_extended_string(ptime t){
So YYYY-MM-DDTHH:MM:SS,fffffffff or YYYY-MM-DDTHH:MM:SS, who is right?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
I just looked into the code, it seems except for some obscure workaround for However this should be documentation in the header AND the HTML documentation, since its neither "Always without fractions" nor "Always with fractions" but "With fraction if fraction is not zero, otherwise without", which booth should be corrected. |
Don't need that, since it really implies non existent precision. The undocumented format behavior has its cause in the field because of some platforms not supplying microsecond precision: ptime microsec_clock::universal_time() :
One might refer to that when documenting this fraction second format switch. |
I've fixed the documentation issue along with other ISO 8601-related documentation fixes, and created a pull request. |
I think this function would be useful. I've rolled my own because I had a requirement to always provide the fractional seconds even if they were 0 (in my case, to microsecond resolution, which matched the time source). This isn't adding "non existent precision" if the micro-second resolution time source happens to provide 0 microseconds when appropriate. |
* to_iso_*string() use "." as fractional separator The fractional separator for the various to_iso_* methods is "." not "," (per to_iso_string_type() implementation). Fix the documentation to match the implementation. * use "ISO 8601" not "iso" in documentation The standard is "ISO 8601", so use that instead of just "iso" or "ISO" in comments and documentation. * fractional seconds only included if non-zero (#110) Consistently document that the fractional seconds are only included if non-zero. Use "where fffffffff" not "were fff".
* fix typo in time_period docs (#212) Co-authored-by: Quinn O'Connor <[email protected]> * Fix constexpr of gregorian::date::date(special_values) to improve perf (#214) GCC up to at least 10.2 fail to resolve gregorian::date::date(special_values) as constexpr function due to assignment to *this within the constructor. Refactoring constructor to initialize the instance once leads to large performance improvement. * Avoid using likely function as multiple projects define a likely macro (#216) * Iso doc fixes (#215) * to_iso_*string() use "." as fractional separator The fractional separator for the various to_iso_* methods is "." not "," (per to_iso_string_type() implementation). Fix the documentation to match the implementation. * use "ISO 8601" not "iso" in documentation The standard is "ISO 8601", so use that instead of just "iso" or "ISO" in comments and documentation. * fractional seconds only included if non-zero (#110) Consistently document that the fractional seconds are only included if non-zero. Use "where fffffffff" not "were fff". * Fix ccache saving on cache hit (#211) See boostorg/boost-ci#166 * chore: bump macos runner version (#213) GitHub Action is sunsetting the macOS 10.15 Actions runner. It will stop working intermittently until being completely removed by 2022-8-30: https://github.blog/changelog/2022-07-20-github-actions-the-macos-10-15-actions-runner-image-is-being-deprecated-and-will-be-removed-by-8-30-22 Co-authored-by: Quinnsicle <[email protected]> Co-authored-by: Quinn O'Connor <[email protected]> Co-authored-by: Povilas Kanapickas <[email protected]> Co-authored-by: Antony Polukhin <[email protected]> Co-authored-by: Luke Mewburn <[email protected]> Co-authored-by: Alexander Grund <[email protected]> Co-authored-by: Baoshuo Ren <[email protected]>
I am using
std::string to_iso_extended_string(ptime)
and have reports that on some system it prints without the second fractions. Consulting the documentation and the header of boost 1.71 I was confronted with inconsistent documentation:The Docs are saying it prints with fractions of a second:
While the accoding header says:
So YYYY-MM-DDTHH:MM:SS,fffffffff or YYYY-MM-DDTHH:MM:SS, who is right?
The text was updated successfully, but these errors were encountered: