Mark As Completed Discussion

Working with Time

In C++, the <chrono> library provides facilities for working with dates, times, and durations. This library is part of the C++ Standard Library and provides a high-level interface for manipulating time-related information.

To work with time in C++, include the <chrono> and <ctime> headers:

TEXT/X-C++SRC
1#include <iostream>
2#include <chrono>
3#include <ctime>
CPP
OUTPUT
:001 > Cmd/Ctrl-Enter to run, Cmd/Ctrl-/ to comment