Skip to content

Instantly share code, notes, and snippets.

@ugovaretto
Created August 20, 2013 09:23
Show Gist options
  • Save ugovaretto/6279247 to your computer and use it in GitHub Desktop.
Save ugovaretto/6279247 to your computer and use it in GitHub Desktop.
Print local time with C++11
#include <iostream>
#include <iomanip>
#include <chrono>
int main(int, char**) {
std::chrono::time_point< std::chrono::system_clock> tp;
tp = std::chrono::system_clock::now();
const std::time_t t = std::chrono::system_clock::to_time_t(tp);
std::cout << asctime(localtime(&t)) << std::endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment