Book Image

Learning Boost C++ Libraries

By : Arindam Mukherjee
Book Image

Learning Boost C++ Libraries

By: Arindam Mukherjee

Overview of this book

Table of Contents (19 chapters)
Learning Boost C++ Libraries
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Using Chrono to measure time


Boost Chrono is a library for time calculations having some overlapping functionality with the Posix Time part of the Date Time library. Like Posix Time, Chrono too uses the notion of time points and durations. Chrono does not deal with dates. It is a newer library than Date Time, and implements the facilities proposed in a paper from the C++ Standards Committee working group (WG21). Parts of that proposal made it to the C++11 Standard Library as the Chrono library, and much of the discussion on Boost Chrono also applies to Chrono Standard Library (std::chrono).

Durations

A duration represents an interval of time. The duration has a numeric magnitude and must be expressed in units of time. The boost::chrono::duration template is used to represent any such duration and is declared as follows:

template <typename Representation, typename Period>
class duration;

The Representation type parameter identifies the underlying arithmetic type used for the magnitude of...