diff options
| author | 2023-05-23 18:32:28 -0400 | |
|---|---|---|
| committer | 2023-06-05 15:15:11 -0400 | |
| commit | 3979c7daa478199cff7bc985fceabcf30fadbc3b (patch) | |
| tree | 52f24a4fed679dbac23aedfa29f2fc79e3d34870 /src/common/time_zone.h | |
| parent | configure_system: Remove external offset on custom rtc (diff) | |
| download | yuzu-3979c7daa478199cff7bc985fceabcf30fadbc3b.tar.gz yuzu-3979c7daa478199cff7bc985fceabcf30fadbc3b.tar.xz yuzu-3979c7daa478199cff7bc985fceabcf30fadbc3b.zip | |
common: Move system time zone string detection
Moves it from Settings to Common::TimeZone, since this algorithm doesn't
depend on the setting. It also lets us use it in other libraries.
common: Various fixes
time_zone: Don't double up the std::abs
Too many absolute values were causing mirrored time zones to resolve
as the same.
Diffstat (limited to 'src/common/time_zone.h')
| -rw-r--r-- | src/common/time_zone.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/common/time_zone.h b/src/common/time_zone.h index 99cae6ef2..f574d5c04 100644 --- a/src/common/time_zone.h +++ b/src/common/time_zone.h | |||
| @@ -3,15 +3,21 @@ | |||
| 3 | 3 | ||
| 4 | #pragma once | 4 | #pragma once |
| 5 | 5 | ||
| 6 | #include <array> | ||
| 6 | #include <chrono> | 7 | #include <chrono> |
| 7 | #include <string> | 8 | #include <string> |
| 8 | 9 | ||
| 9 | namespace Common::TimeZone { | 10 | namespace Common::TimeZone { |
| 10 | 11 | ||
| 12 | [[nodiscard]] const std::array<const char*, 46>& GetTimeZoneStrings(); | ||
| 13 | |||
| 11 | /// Gets the default timezone, i.e. "GMT" | 14 | /// Gets the default timezone, i.e. "GMT" |
| 12 | [[nodiscard]] std::string GetDefaultTimeZone(); | 15 | [[nodiscard]] std::string GetDefaultTimeZone(); |
| 13 | 16 | ||
| 14 | /// Gets the offset of the current timezone (from the default), in seconds | 17 | /// Gets the offset of the current timezone (from the default), in seconds |
| 15 | [[nodiscard]] std::chrono::seconds GetCurrentOffsetSeconds(); | 18 | [[nodiscard]] std::chrono::seconds GetCurrentOffsetSeconds(); |
| 16 | 19 | ||
| 20 | /// Searches time zone offsets for the closest offset to the system time zone | ||
| 21 | [[nodiscard]] std::string FindSystemTimeZone(); | ||
| 22 | |||
| 17 | } // namespace Common::TimeZone | 23 | } // namespace Common::TimeZone |