Time of Day
Get introduced to the time library of C++20.
We'll cover the following...
🔑 Lack of compiler support
At the end of 2020, no C++ compiler supports the chrono extensions so far. Thanks to the prototype library date from Howard Hinnant, which is essentially a superset of the extended time functionality in C++20, you can experiment with it. The library is hosted on GitHub. There are various ways to use the date prototype:
You can try it out on Wandbox. Howard has uploaded the
date.h
header, which is sufficient to play with the new typestd::time_of_day
and the calendar. Here is Howard’s link: Try it out on Wandbox!.Copy the header
date.h
into the search path of your C++ compiler.Download the project and build it. The already mentioned GitHub page date gives you more information. This step is required when you want to try out the new time zone features.
The examples in this chapter use Howard Hinnant’s library. ...