Get Unix timestamp with C++

C++20 introduced a guarantee that time_since_epoch is relative to the UNIX epoch, and cppreference.com gives an example that I’ve distilled to the relevant code, and changed to units of seconds rather than hours: Using C++17 or earlier, time() is the simplest function – seconds since Epoch, which for Linux and UNIX at least would be the UNIX epoch. Linux manpage here. The … Read more