//******************************************************** // The following code example is taken from the book // C++20 - The Complete Guide // by Nicolai M. Josuttis (www.josuttis.com) // http://www.cppstd20.com // // The code is licensed under a // Creative Commons Attribution 4.0 International License // http://creativecommons.org/licenses/by/4.0/ //******************************************************** #include #include int main() { using namespace std::literals; namespace chr = std::chrono; auto tpUtc@ @=@ @chr::clock_cast(chr::sys_days{2017y/1/1}@ @-@ @1000ms); for (auto end = tpUtc + 2500ms; tpUtc <= end; tpUtc += 200ms) { auto tpSys = chr::clock_cast(tpUtc); auto tpGps = chr::clock_cast(tpUtc); auto tpTai = chr::clock_cast(tpUtc); std::cout << std::format("{:%F %T} SYS ", tpSys); std::cout << std::format("{:%F %T %Z} ", tpUtc); std::cout << std::format("{:%F %T %Z} ", tpGps); std::cout << std::format("{:%F %T %Z}\n", tpTai); } }