A <chrono> Tutorial
summary
Chrono is a type-safe C++ time library that wraps integers (seconds are a long long) and performs conversions at compile time with zero runtime overhead; it reports a surprising range of ±292 billion years for seconds, allows implicit lossless conversions but requires duration_cast for lossy ones, and forbids implicit integer↔duration conversions to catch bugs. It provides customizable durations via template ratios, time_point/clock types (system_clock vs steady_clock), and requires .count() to extract raw values for legacy I/O.
AI-written summary · about
chapters (21)
- 0:00Introduction and motivation
- 1:25Why use Chrono library
- 2:50Time durations basics
- 7:27Duration arithmetic
- 9:14Performance overhead
- 12:05Migrating time units
- 17:26Manual conversions
- 21:20Lossy conversions
- 23:51More time units
- 25:36Custom representations
- 29:11Custom durations
- 33:03Duration template details
- 38:20Time points explained
- 41:37Time point arithmetic
- 44:24Time point conversions
- 46:35Clocks in Chrono
- 49:03System vs steady clocks
- 50:06Timing functions
- 51:50Custom durations example
- 52:54System clock time points
- 53:36Summary and Q&A
related talks
31mA Crash Course in Calendars, Dates, Time, and Time Zones
58mC++20’s <chrono> Calendars and Time Zones in MSVC
01h 05mA C++ Approach to Physical Units
29mTime is an illusion
31mUTC time, formally verified
41m“Avoiding Disasters with Strongly Typed C++”
27mI have a Date
01h 01mMoving to C++20 for Fun, Beauty... and Results!
