Repository navigation
Conversation
1. Creating a file then updating its mtime with utimensat UTIME_NOW should never move the mtime backwards. 2. Creating a file, stat-ing it, then using utimesat with the mtime that stat returned, then stating it again should return identical timestamp. Both failing due to some problems with rounding.
hoodmane
force-pushed
the
fix-time-precision
branch
from
October 6, 2026 20:42
68ec8d3 to
86ecc6a
Compare
sbc100
reviewed
Oct 6, 2026
| // Use a sub-millisecond clock for "now" if possible. This is needed to | ||
| // ensure that a later UTIME_NOW doesn't set the time earlier than an | ||
| // earlier UTIME_NOW, see test_utime_now.c | ||
| var now = globalThis.performance?.timeOrigin ? performance.timeOrigin + performance.now() : Date.now(); |
Collaborator
There was a problem hiding this comment.
I think can just write this as emscripten_get_now().
Collaborator
Author
There was a problem hiding this comment.
emscripten_get_now() doesn't add performance.timeOrigin
This reverts commit c78265c.
sbc100
reviewed
Oct 8, 2026
| {{{ makeSetValue('buf', C_STRUCTS.stat.st_ctim.tv_nsec, 'Math.floor((ctime % 1000) * 1_000_000)', SIZE_TYPE) }}}; | ||
| // Round to the nearest 10 microseconds. This matches the granularity | ||
| // that __syscall_utimensat rounds down to when setting timestamps, so | ||
| // that values read via stat() round-trip through utimensat(). |
Collaborator
Author
|
But it would be nice to also add these checks. |
Collaborator
|
Sure, would you have time to create a new PR (or update this one) such that the round parts of #27794 and new tests added? |
Collaborator
Collaborator
Author
|
Okay will do. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Both failing due to some problems with rounding.
This fixes the regressions in the CPython test suite on Emscripten 6.0.11:
python/cpython#158627