Last active
March 15, 2016 14:57
-
-
Save blippy/bd58514d337a5e0b1cfe to your computer and use it in GitHub Desktop.
Formatted creation time of a file
This file contains hidden or 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 <sys/stat.h> | |
| ... | |
| struct stat st; | |
| stat("s2/yfetch.csv", &st); | |
| time_t t = st.st_mtime; | |
| struct tm atm; | |
| localtime_r(&t, &atm); | |
| char dtstamp[80]; | |
| strftime(dtstamp, sizeof(dtstamp), "%Y-%m-%d\t%H:%M:%S", &atm); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment