Added test that detects if clock_cast<Dest>(Source) properly SFINAEs if clock's are not castable, this includes test for steady_clock that is not castable to any wall-clock. Secondly added steady_based_clock based on steady_clock (as name indicates), that clock_cast may be extended to clock non-related to wall-time (sys/utc) using conversion traits. Final example is pair of ambiguous clocks (amb1/amb2_clock) that can convert to each other either using sys_clock or utc_clock. Then the conversion from amb2 to amb1 is disambiguated via trait specialization.
To test: * Install tz.cpp by downloading the IANA timezone database at: http://www.iana.org/time-zones You only need the data, not the code.
-
Change the string
install
in tz.cpp to point to your downloaded IANA database. -
Compile validate.cpp along with tz.cpp.
-
Run the binary and direct the terminal output to a temporary file.
-
Unzip the tzdata file that has the version corresponding to the IANA database you downloaded (e.g. tzdata2015f.txt.zip).
-
Compare the unzipped txt file with the output of your validate test program. If they are identical, the test passes, else it fails.
Miscellaneous:
You can also compare one version of the tzdatabase with another using these uncompressed text files. The text files contain for each timezone its initial state, and each {offset, abbreviation} change contained in the database up through the year 2035. As the database versions change, minor updates to the set of these transitions are typically made, typically due to changes in government policies.
The tests in this section will run much faster with optimizations cranked up.