Std::chrono::duration
std::chrono::duration is a C++ standard library class template representing a time interval with a specified tick period and representation type.
Learn C++ by Example
std::chrono::milliseconds is a C++ chrono duration type whose period is one millisecond.
- How it is used
- Represents and converts fine-grained time intervals in chrono-based countdowns and duration calculations.
- How deep it goes
- Explains the millisecond period and conversion direction, then stops short of defining the duration type internally.
- Examples
- Uses a two-hour assignment to milliseconds and a reverse conversion with duration_cast.
- What you can do after
- Apply it via the C++ chrono library to represent milliseconds and select explicit casts when conversions may lose precision.
Read how Learn C++ by Example explains std::chrono::duration →
C++ Concurrency in Action, Second Edition
`std::chrono::milliseconds` is a C++ standard library duration type representing milliseconds.
- How it is used
- Represents lengths of time and supplies duration arguments for timed waits and lock attempts.
- How deep it goes
- Defines representation and units through a two-parameter template, then demonstrates aliases, literals, and casting without detailing time points.
- Examples
- Uses chrono literals for day, minute, and millisecond values, a millisecond-to-second cast, and a future timeout.
- What you can do after
- Apply durations by constructing values, converting units, and supplying timeouts to timed operations.
Read how C++ Concurrency in Action, Second Edition explains std::chrono::duration →
Related concepts
- time_pointconfigured by · std::chrono::time_point is a C++ standard library class template representing a point in time relative to a clock's epoch, measured using a duration.
- duration_castused by · duration_cast is a C++ standard library function template that explicitly converts a duration from one duration type to another.
- durationkind of · A duration is an amount or span of time, expressed as an interval or in temporal units.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

