mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-06 09:36:08 +00:00
LibJS: Remove unnecessary modulo operation in GetISOPartsFromEpoch
This is an editorial change in the Temporal spec.
See: fc3f80d
This commit is contained in:
parent
0ff6260afb
commit
9c31fee4b5
Notes:
sideshowbarker
2024-07-17 10:00:06 +09:00
Author: https://github.com/linusg
Commit: 9c31fee4b5
Pull-request: https://github.com/SerenityOS/serenity/pull/14367
Reviewed-by: https://github.com/IdanHo
1 changed files with 7 additions and 4 deletions
|
@ -136,13 +136,16 @@ ISODateTime get_iso_parts_from_epoch(GlobalObject& global_object, Crypto::Signed
|
|||
// 10. Let millisecond be ℝ(! msFromTime(epochMilliseconds)).
|
||||
auto millisecond = ms_from_time(epoch_milliseconds);
|
||||
|
||||
// 11. Let microsecond be floor(remainderNs / 1000) modulo 1000.
|
||||
auto microsecond = modulo(floor(remainder_ns / 1000), 1000);
|
||||
// 11. Let microsecond be floor(remainderNs / 1000).
|
||||
auto microsecond = floor(remainder_ns / 1000);
|
||||
|
||||
// 12. Let nanosecond be remainderNs modulo 1000.
|
||||
// 12. Assert: microsecond < 1000.
|
||||
VERIFY(microsecond < 1000);
|
||||
|
||||
// 13. Let nanosecond be remainderNs modulo 1000.
|
||||
auto nanosecond = modulo(remainder_ns, 1000);
|
||||
|
||||
// 13. Return the Record { [[Year]]: year, [[Month]]: month, [[Day]]: day, [[Hour]]: hour, [[Minute]]: minute, [[Second]]: second, [[Millisecond]]: millisecond, [[Microsecond]]: microsecond, [[Nanosecond]]: nanosecond }.
|
||||
// 14. Return the Record { [[Year]]: year, [[Month]]: month, [[Day]]: day, [[Hour]]: hour, [[Minute]]: minute, [[Second]]: second, [[Millisecond]]: millisecond, [[Microsecond]]: microsecond, [[Nanosecond]]: nanosecond }.
|
||||
return { .year = year, .month = month, .day = day, .hour = hour, .minute = minute, .second = second, .millisecond = millisecond, .microsecond = static_cast<u16>(microsecond), .nanosecond = static_cast<u16>(nanosecond) };
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue