Design Rationale for the chrono Library
summary
Lays out concrete design choices: templates for duration(rep and period), implicit lossless conversions and duration_cast for truncation to force safe rounding, and why time_point arithmetic forbids nonsense at compile time. Describes C++11 building blocks and C++20 additions—days weeks months years plus calendrical types like year_month_day and month_day_last—integrated with IANA time zone database and a zone_time pairing that handles DST. Demonstrates a working program that prints biweekly London 18:00 meetings and correct New York times across DST.
AI-written summary · about
chapters (29)
- 0:00Introduction
- 0:51What is chrono
- 1:34Time point
- 2:59Streaming operator
- 4:08Duration
- 5:20Convenience Types
- 5:42Custom Unit Types
- 7:11Conversions
- 10:34Timepoints
- 11:07Logic Errors
- 12:23Time Points
- 13:20Time Points vs Dates
- 17:00What is a Calendar
- 19:52YearMonthDay
- 24:13Year
- 25:22Month
- 26:38Day
- 26:58MonthDay
- 30:09Typesafe
- 32:22Invalid Dates
- 35:36MonthDayLast
- 37:04YearMonthLast
- 40:41MonthWeekDay
- 43:45weekday
- 46:46weekday indexed
- 48:19month year
- 50:23time zones
- 52:48examples
- 56:45zonetime
related talks
05mDateTime Programming For Everyone. Everywhere.
43mTick Tock: Maintaining Time
01h 02mC++20 - My Favorite Code Examples
01h 00mC++20 - the hidden pearls
01h 00mHow to call C libraries from C++
01h 01mDocumentation in the Era of Concepts and Ranges
01h 03mExploration of Strongly-typed Units in C++: A Case Study from Digital Audio
54mC++26: an overview
