Advertisement
Guest User

Untitled

a guest
Feb 7th, 2016
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.62 KB | None | 0 0
  1. using namespace std;
  2.  
  3. string asString (const chrono::system_clock::time_point& tp)
  4. {
  5.     time_t t = chrono::system_clock::to_time_t(tp);
  6.     string ts = asctime(gmtime(&t));
  7.     ts.resize(ts.size()-1);
  8.     return ts;
  9. }
  10.  
  11.  
  12. int main() {
  13.     chrono::system_clock::time_point tp;
  14.     cout << "epoch: " << asString(tp) << endl;
  15.     tp = chrono::system_clock::now();
  16.     cout << "now: " << asString(tp) << endl;
  17.     tp = chrono::system_clock::time_point::max();
  18.     cout << "max: " << asString(tp) << endl;
  19.     tp = chrono::system_clock::time_point::min();
  20.     cout << "min: " << asString(tp) << endl;
  21.     return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement