1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:47:44 +00:00

AK: Rename Time to Duration

That's what this class really is; in fact that's what the first line of
the comment says it is.

This commit does not rename the main files, since those will contain
other time-related classes in a little bit.
This commit is contained in:
kleines Filmröllchen 2023-03-13 16:30:34 +01:00 committed by Jelle Raaijmakers
parent 82ddc813d5
commit 213025f210
140 changed files with 634 additions and 628 deletions

View file

@ -131,7 +131,7 @@ static double parse_simplified_iso8601(DeprecatedString const& iso_8601)
// We parsed a valid date simplified ISO 8601 string.
VERIFY(year.has_value()); // A valid date string always has at least a year.
auto time = AK::Time::from_timestamp(*year, month.value_or(1), day.value_or(1), hours.value_or(0), minutes.value_or(0), seconds.value_or(0), milliseconds.value_or(0));
auto time = AK::Duration::from_timestamp(*year, month.value_or(1), day.value_or(1), hours.value_or(0), minutes.value_or(0), seconds.value_or(0), milliseconds.value_or(0));
auto time_ms = static_cast<double>(time.to_milliseconds());
// https://tc39.es/ecma262/#sec-date.parse:
@ -208,7 +208,7 @@ ThrowCompletionOr<Value> DateConstructor::call()
{
// 1. If NewTarget is undefined, then
// a. Let now be the time value (UTC) identifying the current time.
auto now = AK::Time::now_realtime().to_milliseconds();
auto now = AK::Duration::now_realtime().to_milliseconds();
// b. Return ToDateString(now).
return PrimitiveString::create(vm(), to_date_string(now));
@ -225,7 +225,7 @@ ThrowCompletionOr<NonnullGCPtr<Object>> DateConstructor::construct(FunctionObjec
// 3. If numberOfArgs = 0, then
if (vm.argument_count() == 0) {
// a. Let dv be the time value (UTC) identifying the current time.
auto now = AK::Time::now_realtime().to_milliseconds();
auto now = AK::Duration::now_realtime().to_milliseconds();
date_value = static_cast<double>(now);
}
// 4. Else if numberOfArgs = 1, then