mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 03:57:44 +00:00
LibJS: Support modulo(x, y) with different types
It's a bit annoying having to add '.0' to y given that it's an integral number in most cases. This turns the single template parameter T into T and U to permit that.
This commit is contained in:
parent
1ec917aa23
commit
9c209b8079
5 changed files with 15 additions and 14 deletions
|
@ -150,10 +150,10 @@ ISODateTime get_iso_parts_from_epoch(BigInt const& epoch_nanoseconds)
|
|||
auto millisecond = ms_from_time(epoch_milliseconds);
|
||||
|
||||
// 11. Let microsecond be floor(remainderNs / 1000) modulo 1000.
|
||||
auto microsecond = modulo(floor(remainder_ns / 1000), 1000.0);
|
||||
auto microsecond = modulo(floor(remainder_ns / 1000), 1000);
|
||||
|
||||
// 12. Let nanosecond be remainderNs modulo 1000.
|
||||
auto nanosecond = modulo(remainder_ns, 1000.0);
|
||||
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 }.
|
||||
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