1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
#include <stdlib.h> #include <stdio.h> #include <time.h> int main(int argc, char *argv[]) { time_t t; if (argc>1) { t = (time_t)strtoll(argv[1],NULL,0); } else { t = time(NULL); } printf("%lld = %s",(long long)t, ctime(&t)); return 0; }