GCC Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
libstdc++

libstdc++: Enable most of <chrono> for freestanding

Most of the C++ <chrono> library is now available for freestanding environments.

This commit enables most of the C++ <chrono> library for freestanding environments. This was achieved by adjusting feature test macros and moving declarations outside of hosted-only groups. Functionality that relies on host-specific features like now() member functions, file_clock, and tzdb access has been excluded or adapted. Conversions to/from std::time_t now use long long in freestanding mode, and leap second information uses a hardcoded list.

In Details

This patch makes the <chrono> library more usable in freestanding environments by conditionally compiling or adapting its components. Key changes include: replacing std::time_t with long long for freestanding time conversions, using a static leap second list instead of tzdb, and disabling or adapting components like now(), file_clock, and zoned_time's dependency on time_zone*. A new feature test macro, __glibcxx_freestanding_chrono, is introduced.

For Context
freestanding environment
An execution environment that provides minimal standard library support, typically used in embedded systems or kernels where only essential functions are available.
<chrono>
A C++ standard library header that provides facilities for measuring and manipulating time.
feature test macro
A macro defined by the C++ standard library to indicate the availability of a specific feature or standard version. Used for conditional compilation.
hosted environment
An execution environment that provides a full C++ standard library and operating system services.
tzdb
Time Zone DataBase. A collection of historical time zone and daylight saving time rules used by systems to perform time calculations.
std::time_t
A C++ arithmetic type representing time, typically the number of seconds since the Epoch (January 1, 1970).
Filed Under: libstdc++chronofreestanding