comparison include/core/time.h @ 305:91ac90a34003

core/time: remove Duration class, use regular functions instead this class was pretty useless anyway
author Paper <paper@paper.us.eu.org>
date Sun, 19 May 2024 15:56:20 -0400
parents 3ec7804abf17
children da2c5a8ff306
comparison
equal deleted inserted replaced
304:2115488eb302 305:91ac90a34003
3 3
4 #include <cstdint> 4 #include <cstdint>
5 #include <string> 5 #include <string>
6 namespace Time { 6 namespace Time {
7 7
8 class Duration { 8 /* this is in SECONDS */
9 public: 9 using Timestamp = uint64_t;
10 Duration(int64_t l);
11 int64_t InSeconds();
12 int64_t InMinutes();
13 int64_t InHours();
14 int64_t InDays();
15 std::string AsRelativeString();
16 10
17 private: 11 enum class Units {
18 int64_t length; 12 Seconds,
13 Minutes
19 }; 14 };
15
16 std::string GetSecondsAsRelativeString(Timestamp length);
17 std::string GetSecondsAsAbsoluteString(Units unit_cutoff, Timestamp amount, double unit_in_seconds = 1.0);
20 18
21 int64_t GetSystemTime(); 19 int64_t GetSystemTime();
22 20
23 }; // namespace Time 21 }; // namespace Time
24 22