fix: Make StdClock monotonic using std::time::Instant#4841
fix: Make StdClock monotonic using std::time::Instant#4841jedel1043 merged 6 commits intoboa-dev:mainfrom
Conversation
|
Heyy @jedel1043 , I have refactored the API design as we discussed. Please take a look when ever you are available :) |
Test262 conformance changes
Tested main commit: |
|
Heyy I have put pushed my latest commit, but it doesn't seem to be pushed here due to some github issue. 🥲 |
jedel1043
left a comment
There was a problem hiding this comment.
Yep, pretty much what I expected. Thanks!
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #4841 +/- ##
===========================================
+ Coverage 47.24% 58.97% +11.72%
===========================================
Files 476 563 +87
Lines 46892 62584 +15692
===========================================
+ Hits 22154 36908 +14754
- Misses 24738 25676 +938 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
core/engine/Cargo.toml
Outdated
| static_assertions.workspace = true | ||
| futures-channel.workspace = true | ||
| aligned-vec.workspace = true | ||
| instant.workspace = true |
There was a problem hiding this comment.
Need to remove this dependency
Cargo.toml
Outdated
| wasm-bindgen = { version = "0.2.97", default-features = false } | ||
| getrandom = { version = "0.4.1", default-features = false } | ||
| console_error_panic_hook = "0.1.7" | ||
| instant = { version = "0.1", features = ["wasm-bindgen"] } |
There was a problem hiding this comment.
Also here, needs to be removed
Signed-off-by: Abhinav Sharma <abhinavs1920bpl@gmail.com>
Signed-off-by: Abhinav Sharma <abhinavs1920bpl@gmail.com>
This Pull Request fixes/closes #4330 .
Previously,
StdClockusedSystemTimewhich isn't monotonic—it can jump backward when the system clock adjusts. This broke the guarantees thatJsInstantis supposed to provide for engine timing.Now
StdClockusesstd::time::Instantwith a base instant, measuring elapsed time from that point. This makesJsInstanttruly monotonic likestd::time::Instant, so time never goes backward forsetTimeout,setInterval, and job scheduling.For
Dateobjects that need actual wall-clock time, I added a separatesystem_time_millis()method to theClocktrait. Clean separation of concerns.Added tests to verify the monotonic behavior works as expected.