mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 08:47:34 +00:00
AK: Remove now-unused Duration methods
These are not applicable to Duration, since it's not a timestamp class.
This commit is contained in:
parent
effcd080ca
commit
69e27169c4
2 changed files with 0 additions and 30 deletions
10
AK/Time.cpp
10
AK/Time.cpp
|
@ -217,16 +217,6 @@ static Duration now_time_from_clock(clockid_t clock_id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Duration Duration::now_realtime()
|
|
||||||
{
|
|
||||||
return now_time_from_clock(CLOCK_REALTIME);
|
|
||||||
}
|
|
||||||
|
|
||||||
Duration Duration::now_realtime_coarse()
|
|
||||||
{
|
|
||||||
return now_time_from_clock(CLOCK_REALTIME_COARSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
Duration Duration::now_monotonic()
|
Duration Duration::now_monotonic()
|
||||||
{
|
{
|
||||||
return now_time_from_clock(CLOCK_MONOTONIC);
|
return now_time_from_clock(CLOCK_MONOTONIC);
|
||||||
|
|
20
AK/Time.h
20
AK/Time.h
|
@ -191,24 +191,6 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
[[nodiscard]] constexpr static Duration from_timestamp(i32 year, u8 month, u8 day, u8 hour, u8 minute, u8 second, u16 millisecond)
|
|
||||||
{
|
|
||||||
constexpr auto milliseconds_per_day = 86'400'000;
|
|
||||||
constexpr auto milliseconds_per_hour = 3'600'000;
|
|
||||||
constexpr auto milliseconds_per_minute = 60'000;
|
|
||||||
constexpr auto milliseconds_per_second = 1'000;
|
|
||||||
|
|
||||||
i64 milliseconds_since_epoch = days_since_epoch(year, month, day);
|
|
||||||
milliseconds_since_epoch *= milliseconds_per_day;
|
|
||||||
|
|
||||||
milliseconds_since_epoch += hour * milliseconds_per_hour;
|
|
||||||
milliseconds_since_epoch += minute * milliseconds_per_minute;
|
|
||||||
milliseconds_since_epoch += second * milliseconds_per_second;
|
|
||||||
milliseconds_since_epoch += millisecond;
|
|
||||||
|
|
||||||
return from_milliseconds(milliseconds_since_epoch);
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] constexpr static Duration from_seconds(i64 seconds) { return Duration(seconds, 0); }
|
[[nodiscard]] constexpr static Duration from_seconds(i64 seconds) { return Duration(seconds, 0); }
|
||||||
[[nodiscard]] constexpr static Duration from_nanoseconds(i64 nanoseconds)
|
[[nodiscard]] constexpr static Duration from_nanoseconds(i64 nanoseconds)
|
||||||
{
|
{
|
||||||
|
@ -234,8 +216,6 @@ public:
|
||||||
[[nodiscard]] constexpr static Duration max() { return Duration(__INT64_MAX__, 999'999'999); };
|
[[nodiscard]] constexpr static Duration max() { return Duration(__INT64_MAX__, 999'999'999); };
|
||||||
|
|
||||||
#ifndef KERNEL
|
#ifndef KERNEL
|
||||||
[[nodiscard]] static Duration now_realtime();
|
|
||||||
[[nodiscard]] static Duration now_realtime_coarse();
|
|
||||||
[[nodiscard]] static Duration now_monotonic();
|
[[nodiscard]] static Duration now_monotonic();
|
||||||
[[nodiscard]] static Duration now_monotonic_coarse();
|
[[nodiscard]] static Duration now_monotonic_coarse();
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue