1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 17:37:34 +00:00

AK: Add Time::from_ticks()

This helper allows Time to be constructed from a tick count and a ticks
per second value.
This commit is contained in:
Lucas CHOLLET 2022-01-31 19:02:03 +01:00 committed by Andreas Kling
parent 5238e38886
commit 39bfc48ea7
2 changed files with 10 additions and 0 deletions

View file

@ -187,6 +187,7 @@ public:
i64 seconds = sane_mod(milliseconds, 1'000);
return Time(seconds, milliseconds * 1'000'000);
}
[[nodiscard]] static Time from_ticks(clock_t, time_t);
[[nodiscard]] static Time from_timespec(const struct timespec&);
[[nodiscard]] static Time from_timeval(const struct timeval&);
// We don't pull in <stdint.h> for the pretty min/max definitions because this file is also included in the Kernel