1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
// time_point_cast
#include <iostream>
#include <ratio>
#include <chrono>
int main ()
{
using namespace std::chrono;
typedef duration<int,std::ratio<60*60*24>> days_type;
time_point<system_clock,days_type> today = time_point_cast<days_type>(system_clock::now());
std::cout << today.time_since_epoch().count() << " days since epoch" << std::endl;
return 0;
}
| |