mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +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:
committed by
Jelle Raaijmakers
parent
0dfcaf1389
commit
c1323febc2
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
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user