How Old Am I in Seconds? Insights From the C++ chrono Library
summary
C++ chrono pairs C++11 durations/time_points with C++20 calendars, formatting and time zones to handle real cases: compile‑time unit selection to avoid overflow, year/month/day types with validation and last‑day semantics, integration with the IANA time zone database (≈500 KB), and separate clocks (system, steady, UTC, GPS, TAI) so leap seconds are representable. Practical surprises: converting a birthday to UTC can add about 27 seconds difference using UTC vs system clock, and std::format adopts familiar strftime specifiers.
AI-written summary · about
chapters (9)
- 0:00C++ chrono library intro
- 1:09Evolution in C++11 and C++20
- 13:19Durations and time points
- 20:53Duration pitfalls and overflows
- 28:52C++20 calendar features
- 44:45Time zones and IANA
- 1:00:26Clocks and leap seconds
- 1:10:03Age in seconds calculation
- 1:13:51Q&A
related talks
03m<chrono> Then and Now
59m“A C++14 approach to dates and times"
01h 05mWelcome To The Time Zone
51mUsing std::chrono Calendar Dates for Finance in Cpp
32mYou Depend on Time, This Is How It Works and You Won’t...
05mA Private Tutorial on C++ chrono
55mCalendrical C++: std::chrono, History, Mathematics and the Computus
35mMastering date/time handling with Elixir
