Pārlūkot izejas kodu

LibJS: Capture sub-second nanoseconds as a u64 in FormatTimeString

This is not a plain nanosecond value (which has a range of [0, 999]).
Rather, it is all of the sub-second components added together.
Timothy Flynn 8 mēneši atpakaļ
vecāks
revīzija
7f3de3be9c

+ 1 - 1
Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp

@@ -684,7 +684,7 @@ String format_fractional_seconds(u64 sub_second_nanoseconds, Precision precision
 }
 
 // 13.25 FormatTimeString ( hour, minute, second, subSecondNanoseconds, precision [ , style ] ), https://tc39.es/proposal-temporal/#sec-temporal-formattimestring
-String format_time_string(u8 hour, u8 minute, u8 second, u16 sub_second_nanoseconds, SecondsStringPrecision::Precision precision, Optional<TimeStyle> style)
+String format_time_string(u8 hour, u8 minute, u8 second, u64 sub_second_nanoseconds, SecondsStringPrecision::Precision precision, Optional<TimeStyle> style)
 {
     // 1. If style is present and style is UNSEPARATED, let separator be the empty String; otherwise, let separator be ":".
     auto separator = style == TimeStyle::Unseparated ? ""sv : ":"sv;

+ 1 - 1
Libraries/LibJS/Runtime/Temporal/AbstractOperations.h

@@ -158,7 +158,7 @@ RoundingIncrement maximum_temporal_duration_rounding_increment(Unit);
 Crypto::UnsignedBigInteger const& temporal_unit_length_in_nanoseconds(Unit);
 ThrowCompletionOr<bool> is_partial_temporal_object(VM&, Value);
 String format_fractional_seconds(u64, Precision);
-String format_time_string(u8 hour, u8 minute, u8 second, u16 sub_second_nanoseconds, SecondsStringPrecision::Precision, Optional<TimeStyle> = {});
+String format_time_string(u8 hour, u8 minute, u8 second, u64 sub_second_nanoseconds, SecondsStringPrecision::Precision, Optional<TimeStyle> = {});
 UnsignedRoundingMode get_unsigned_rounding_mode(RoundingMode, Sign);
 double apply_unsigned_rounding_mode(double, double r1, double r2, UnsignedRoundingMode);
 Crypto::SignedBigInteger apply_unsigned_rounding_mode(Crypto::SignedDivisionResult const&, Crypto::SignedBigInteger const& r1, Crypto::SignedBigInteger const& r2, UnsignedRoundingMode, Crypto::UnsignedBigInteger const& increment);