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

Fix building with upcoming fmt-10 library #677

Merged
merged 2 commits into from
Jun 28, 2023
Merged

Conversation

jan-kolarik
Copy link
Member

@jan-kolarik jan-kolarik commented Jun 28, 2023

As implicit conversions for enums were deprecated in fmt 10.0.0, we need to explicitly do the conversion for custom enums. See: https://github.com/fmtlib/fmt/blob/10.0.0/ChangeLog.rst?plain=1#L68

Also, using fmt 10, time_point<system_clock> contains seconds represented as a floating-point number. In order to drop the decimal places, we need to explicitly do the conversion. This is also conformant with the currently used fmt-9.1 docs: https://fmt.dev/9.1.0/syntax.html#chrono-format-specifications.

Bugzilla ticket: https://bugzilla.redhat.com/show_bug.cgi?id=2218180.
Closes #675.

As implicit conversions for enums were deprecated in fmt 10.0.0, we need to explicitly do the conversion for custom enums.

See: https://github.com/fmtlib/fmt/blob/10.0.0/ChangeLog.rst?plain=1#L68
Using fmt 10, `time_point<system_clock>` contains seconds represented as a floating-point number. In order to drop the decimal places, we need to explicitly do the conversion. This is also conformant with the currently used fmt-9.1 docs: https://fmt.dev/9.1.0/syntax.html#chrono-format-specifications.
@xvitaly
Copy link

xvitaly commented Jun 28, 2023

time_point is a known regression: fmtlib/fmt#3430

I backported fix in fmt-10.0.0-2.fc39.

@jan-kolarik
Copy link
Member Author

@xvitaly Oh, nice! Thanks for info, I will test it and eventually drop the commit.

@jan-kolarik
Copy link
Member Author

jan-kolarik commented Jun 28, 2023

Hmm, actually the commit seems needed in our case. The formatting of seconds remains changed even with fmt-10.0.0-2.fc39 installed (note that "expected" and "actual" are swapped in the output):

test_loggers.cpp:134:Assertion
Test name: LoggersTest::test_loggers
equality assertion failed
- Expected: 2020-02-25T04:25:06.000000000+0000 [25] INFO Info message
2020-02-25T04:25:07.000000000+0000 [25] DEBUG Debug message
2020-02-25T04:25:08.000000000+0000 [25] TRACE Trace message
2020-02-25T04:25:09.000000000+0000 [25] CRITICAL Critical message
2020-02-25T04:25:10.000000000+0000 [25] ERROR Error message
2020-02-25T04:25:11.000000000+0000 [25] WARNING Warning message
2020-02-25T04:25:12.000000000+0000 [25] NOTICE Notice message
2020-02-25T04:25:13.000000000+0000 [25] INFO Info message
2020-02-25T04:25:14.000000000+0000 [25] DEBUG Debug message
2020-02-25T04:25:15.000000000+0000 [25] TRACE Trace message
2020-02-25T04:25:16.000000000+0000 [25] INFO Info additional message

- Actual  : 2020-02-25T04:25:06+0000 [25] INFO Info message
2020-02-25T04:25:07+0000 [25] DEBUG Debug message
2020-02-25T04:25:08+0000 [25] TRACE Trace message
2020-02-25T04:25:09+0000 [25] CRITICAL Critical message
2020-02-25T04:25:10+0000 [25] ERROR Error message
2020-02-25T04:25:11+0000 [25] WARNING Warning message
2020-02-25T04:25:12+0000 [25] NOTICE Notice message
2020-02-25T04:25:13+0000 [25] INFO Info message
2020-02-25T04:25:14+0000 [25] DEBUG Debug message
2020-02-25T04:25:15+0000 [25] TRACE Trace message
2020-02-25T04:25:16+0000 [25] INFO Info additional message

@kontura kontura added this pull request to the merge queue Jun 28, 2023
Merged via the queue into main with commit 5af8dd2 Jun 28, 2023
@kontura kontura deleted the jkolarik/fmt-10-fix branch June 28, 2023 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Build error against fmt 10
3 participants