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:
parent
0dfcaf1389
commit
c1323febc2
7 changed files with 154 additions and 0 deletions
10
AK/Time.cpp
10
AK/Time.cpp
|
@ -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
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue