Created
April 23, 2014 08:00
-
-
Save psycharo-zz/11206272 to your computer and use it in GitHub Desktop.
get a (date) timestamp in c++
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <ctime> | |
using namespace std; | |
inline std::string date_string() | |
{ | |
time_t rawtime; | |
std::time(&rawtime); | |
struct tm *tinfo = std::localtime(&rawtime); | |
char buffer[12]; | |
strftime(buffer, 12, "%F", tinfo); | |
return std::string(buffer); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment