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 "../macros.hpp"
13#include "terminate.hpp"
14#include "exception.hpp"
15#include <chrono>
16
17hi_export_module(hikogui.utility.time_zone);
18
19hi_export namespace hi { inline namespace v1 {
20namespace detail {
21
22[[nodiscard]] inline std::chrono::time_zone const *_cached_current_zone() noexcept
23{
24 try {
25 return std::chrono::current_zone();
26 } catch (...) {
27 hi_no_default("std::chrono::current_zone() throws");
28 }
29}
30
31} // namespace detail
32
39[[nodiscard]] inline std::chrono::time_zone const& cached_current_zone() noexcept
40{
41 static auto *zone = detail::_cached_current_zone();
42 return *zone;
43}
44
45}} // namespace hi::v1
Utilities for throwing exceptions and terminating the application.
The HikoGUI namespace.
Definition array_generic.hpp:20
std::chrono::time_zone const & cached_current_zone() noexcept
Cached current time zone.
Definition time_zone.hpp:39
DOXYGEN BUG.
Definition algorithm_misc.hpp:20