-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
Logging's msecs doesn't handle "100ms" well. #102402
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
Comments
I agree with @dougthor42 about the proposed solution, since time library itself suggests to "use time_ns() to avoid the precision loss caused by the float type". |
I hope to find some time this weekend to implement a fix. |
diegorusso
pushed a commit
to diegorusso/cpython
that referenced
this issue
Apr 17, 2024
…()` in `logging.LogRecord` (pythonGH-102412)
vstinner
added a commit
to vstinner/cpython
that referenced
this issue
Apr 17, 2024
…n() leak Fix a reference leak in test_relativeCreated_has_higher_precision() of test_logging: don't reimport the logging the logging module.
vstinner
added a commit
that referenced
this issue
Apr 18, 2024
…ak (#117985) Fix a reference leak in test_relativeCreated_has_higher_precision() of test_logging: don't reimport the logging the logging module.
serhiy-storchaka
added a commit
to serhiy-storchaka/cpython
that referenced
this issue
Apr 18, 2024
…implementation dependent
serhiy-storchaka
added a commit
that referenced
this issue
Apr 30, 2024
…entation dependent (GH-118062)
SonicField
pushed a commit
to SonicField/cpython
that referenced
this issue
May 8, 2024
…implementation dependent (pythonGH-118062)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Bug report
LogRecord.msecs
returns an incorrect value when timestamp (self.ct
) value has exactly 100ms.One liner check:
The issue is binary representation of "0.1" / floating point error:
Your environment
Discussion
I think switching to
time.time_ns
when setting the creation time might be one solution.Linked PRs
time.time_ns()
inlogging.LogRecord
#102412The text was updated successfully, but these errors were encountered: