liveBook · Manning

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.

How 2 Manning books explain it

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

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.