Skip to content
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

Open
Superlokkus opened this issue Oct 10, 2019 · 5 comments
Open

to_iso_extended_string documentation wrong about fraction print #110

Superlokkus opened this issue Oct 10, 2019 · 5 comments

Comments

@Superlokkus
Copy link

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?

@JeffGarland
Copy link
Collaborator

JeffGarland commented Oct 10, 2019 via email

@Superlokkus
Copy link
Author

I just looked into the code, it seems except for some obscure workaround for _MSC_VER < 1300 the format really is either with fractions when non zero or without fractions otherwise.

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.

@Superlokkus
Copy link
Author

I have a version if the function around somewhere that consistently prints the fractional second even when zero.

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() :

Win32 systems often do not achieve microsecond resolution via this API. If higher resolution is critical to your application test your platform to see the achieved resolution.

One might refer to that when documenting this fraction second format switch.

@lukem lukem mentioned this issue Aug 7, 2022
@lukem
Copy link
Contributor

lukem commented Aug 7, 2022

I've fixed the documentation issue along with other ISO 8601-related documentation fixes, and created a pull request.

@lukem
Copy link
Contributor

lukem commented Aug 7, 2022

I have a version if the function around somewhere that consistently prints the fractional second even when zero.

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.

JeffGarland pushed a commit that referenced this issue Sep 20, 2022
* 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".
JeffGarland added a commit that referenced this issue Oct 31, 2022
* 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants