1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 13:17:35 +00:00

AK: Introduce UnixDateTime

This is a generic wrapper for a time instant relative to the unix epoch,
and does not account for leap seconds. It should be used in place of
Duration in most current cases.
This commit is contained in:
kleines Filmröllchen 2023-03-13 22:06:22 +01:00 committed by Jelle Raaijmakers
parent 0dfcaf1389
commit c1323febc2
7 changed files with 154 additions and 0 deletions

View file

@ -237,6 +237,16 @@ Duration Duration::now_monotonic_coarse()
return now_time_from_clock(CLOCK_MONOTONIC_COARSE);
}
UnixDateTime UnixDateTime::now()
{
return UnixDateTime { now_time_from_clock(CLOCK_REALTIME) };
}
UnixDateTime UnixDateTime::now_coarse()
{
return UnixDateTime { now_time_from_clock(CLOCK_REALTIME_COARSE) };
}
#endif
}