Mercurial > minori
comparison include/core/time.h @ 308:da2c5a8ff306
time: don't use time_t!
| author | Paper <paper@paper.us.eu.org> |
|---|---|
| date | Tue, 11 Jun 2024 04:24:19 -0400 |
| parents | 91ac90a34003 |
| children | d928ec7b6a0d |
comparison
equal
deleted
inserted
replaced
| 307:8769c5d50b06 | 308:da2c5a8ff306 |
|---|---|
| 4 #include <cstdint> | 4 #include <cstdint> |
| 5 #include <string> | 5 #include <string> |
| 6 namespace Time { | 6 namespace Time { |
| 7 | 7 |
| 8 /* this is in SECONDS */ | 8 /* this is in SECONDS */ |
| 9 using Timestamp = uint64_t; | 9 using Timestamp = int64_t; |
| 10 | 10 |
| 11 enum class Units { | 11 enum class Units { |
| 12 Seconds, | 12 Seconds, |
| 13 Minutes | 13 Minutes |
| 14 }; | 14 }; |
| 15 | 15 |
| 16 std::string GetSecondsAsRelativeString(Timestamp length); | 16 std::string GetSecondsAsRelativeString(Timestamp length); |
| 17 std::string GetSecondsAsAbsoluteString(Units unit_cutoff, Timestamp amount, double unit_in_seconds = 1.0); | 17 std::string GetSecondsAsAbsoluteString(Units unit_cutoff, Timestamp amount, double unit_in_seconds = 1.0); |
| 18 | 18 |
| 19 int64_t GetSystemTime(); | 19 /* in UTC */ |
| 20 Timestamp GetSystemTime(); | |
| 20 | 21 |
| 21 }; // namespace Time | 22 }; // namespace Time |
| 22 | 23 |
| 23 #endif // MINORI_CORE_TIME_H_ | 24 #endif // MINORI_CORE_TIME_H_ |
