mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-02 14:19:15 +00:00
LibJS: Fix modulo in get_iso_parts_from_epoch() for negative epoch ns
This now matches the spec change from reminder() to modulo which was
done here: bdf60f5
This commit is contained in:
parent
61410e05eb
commit
c56e5139f5
Notes:
sideshowbarker
2024-07-17 22:22:19 +09:00
Author: https://github.com/linusg
Commit: c56e5139f5
Pull-request: https://github.com/SerenityOS/serenity/pull/11355
Reviewed-by: https://github.com/IdanHo ✅
Reviewed-by: https://github.com/trflynn89
2 changed files with 7 additions and 1 deletions
|
@ -121,7 +121,7 @@ ISODateTime get_iso_parts_from_epoch(BigInt const& epoch_nanoseconds)
|
|||
// 1. Assert: epochNanoseconds is an integer.
|
||||
|
||||
// 2. Let remainderNs be epochNanoseconds modulo 10^6.
|
||||
auto remainder_ns_bigint = epoch_nanoseconds.big_integer().divided_by(Crypto::UnsignedBigInteger { 1'000'000 }).remainder;
|
||||
auto remainder_ns_bigint = modulo(epoch_nanoseconds.big_integer(), Crypto::UnsignedBigInteger { 1'000'000 });
|
||||
auto remainder_ns = remainder_ns_bigint.to_double();
|
||||
|
||||
// 3. Let epochMilliseconds be (epochNanoseconds − remainderNs) / 10^6.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue