mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
LibUnicode: Prefix AK::Duration with AK Namespace
This commit is contained in:
parent
f8d1a25254
commit
2fa9ec20bd
Notes:
sideshowbarker
2024-07-18 23:46:45 +09:00
Author: https://github.com/ADKaster Commit: https://github.com/LadybirdBrowser/ladybird/commit/2fa9ec20bd1 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/676 Reviewed-by: https://github.com/AtkinsSJ ✅ Reviewed-by: https://github.com/trflynn89 ✅
3 changed files with 5 additions and 5 deletions
|
@ -70,7 +70,7 @@ TEST_CASE(resolve_primary_time_zone)
|
||||||
|
|
||||||
using enum Unicode::TimeZoneOffset::InDST;
|
using enum Unicode::TimeZoneOffset::InDST;
|
||||||
|
|
||||||
static void test_offset(StringView time_zone, i64 time, Duration expected_offset, Unicode::TimeZoneOffset::InDST expected_in_dst)
|
static void test_offset(StringView time_zone, i64 time, AK::Duration expected_offset, Unicode::TimeZoneOffset::InDST expected_in_dst)
|
||||||
{
|
{
|
||||||
auto actual_offset = Unicode::time_zone_offset(time_zone, AK::UnixDateTime::from_seconds_since_epoch(time));
|
auto actual_offset = Unicode::time_zone_offset(time_zone, AK::UnixDateTime::from_seconds_since_epoch(time));
|
||||||
VERIFY(actual_offset.has_value());
|
VERIFY(actual_offset.has_value());
|
||||||
|
@ -79,9 +79,9 @@ static void test_offset(StringView time_zone, i64 time, Duration expected_offset
|
||||||
EXPECT_EQ(actual_offset->in_dst, expected_in_dst);
|
EXPECT_EQ(actual_offset->in_dst, expected_in_dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
static constexpr Duration offset(i64 sign, i64 hours, i64 minutes, i64 seconds)
|
static constexpr AK::Duration offset(i64 sign, i64 hours, i64 minutes, i64 seconds)
|
||||||
{
|
{
|
||||||
return Duration::from_seconds(sign * ((hours * 3600) + (minutes * 60) + seconds));
|
return AK::Duration::from_seconds(sign * ((hours * 3600) + (minutes * 60) + seconds));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Useful website to convert times in the TZDB (which sometimes are and aren't UTC) to UTC and the desired local time:
|
// Useful website to convert times in the TZDB (which sometimes are and aren't UTC) to UTC and the desired local time:
|
||||||
|
|
|
@ -134,7 +134,7 @@ Optional<TimeZoneOffset> time_zone_offset(StringView time_zone, UnixDateTime tim
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
return TimeZoneOffset {
|
return TimeZoneOffset {
|
||||||
.offset = Duration::from_milliseconds(raw_offset + dst_offset),
|
.offset = AK::Duration::from_milliseconds(raw_offset + dst_offset),
|
||||||
.in_dst = dst_offset == 0 ? TimeZoneOffset::InDST::No : TimeZoneOffset::InDST::Yes,
|
.in_dst = dst_offset == 0 ? TimeZoneOffset::InDST::No : TimeZoneOffset::InDST::Yes,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ struct TimeZoneOffset {
|
||||||
Yes,
|
Yes,
|
||||||
};
|
};
|
||||||
|
|
||||||
Duration offset;
|
AK::Duration offset;
|
||||||
InDST in_dst { InDST::No };
|
InDST in_dst { InDST::No };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue