Created
August 24, 2016 14:41
-
-
Save niftycode/2eb64123dcdca7a8b4f3969e73493a8d to your computer and use it in GitHub Desktop.
Convert the UNIX time to a human readable string
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
/* EpochConverter */ | |
#include <iostream> | |
#include <time.h> | |
using namespace std; | |
int main(int argc, const char * argv[]) { | |
int inputTime; | |
struct tm *timeinfo; | |
// Enter epoch time | |
cout << "Epoch time: " << endl; | |
cin >> inputTime; | |
time_t rawtime = inputTime; | |
timeinfo = localtime(&rawtime); | |
printf("%s\n", asctime(timeinfo)); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment