While most time zones use simple hour offsets from UTC, some regions have chosen unusual time differences. In this blog post, we’ll explore how we can discover such zones using C++20’s chrono library.
Around the World in C++: Exploring Time Zones with std::chrono
by Bartlomiej Filipek
From the article:
We’ll use GCC 14.2 as it fully supports C++20 chrono and also
std::print
from C++23.First Attempt: Basic Zone Iteration
C++20 introduced comprehensive time zone support through the
<chrono>
library. The implementation relies on the IANA Time Zone Database (also known as the “tz database” or “zoneinfo”), which is the de facto standard for time zone information used by most operating systems and programming languages.The Time Zone Database
In C++20, the time zone database is represented by the
tzdb
class:
Add a Comment
Comments are closed.