HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
time_zone.hpp
Go to the documentation of this file.
1// Copyright Take Vos 2021.
2// Distributed under the Boost Software License, Version 1.0.
3// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
4
10#pragma once
11
12#include "debugger.hpp"
13#include "exception.hpp"
14#include <chrono>
15
16namespace hi { inline namespace v1 {
17namespace detail {
18
19[[nodiscard]] inline std::chrono::time_zone const *_cached_current_zone() noexcept
20{
21 try {
22 return std::chrono::current_zone();
23 } catch (...) {
24 hi_debug_abort("std::chrono::current_zone() throws");
25 }
26}
27
28} // namespace detail
29
36[[nodiscard]] inline std::chrono::time_zone const& cached_current_zone() noexcept
37{
38 static auto *zone = detail::_cached_current_zone();
39 return *zone;
40}
41
42}} // namespace hi::v1
Utilities to interact with the debugger this application runs under.
#define hi_debug_abort(...)
Debug-break and abort the application.
Definition debugger.hpp:50
Utilities for throwing exceptions and terminating the application.
DOXYGEN BUG.
Definition algorithm.hpp:13
geometry/margins.hpp
Definition cache.hpp:11
std::chrono::time_zone const & cached_current_zone() noexcept
Cached current time zone.
Definition time_zone.hpp:36