/** * checktime * A quick check to see how many bits are in a time_t struct. */ #include #include #define PRINT_INT(i) printf ("%s: %d\n", #i, (int) i) int main (int argc, char *argv[]) { PRINT_INT (time (NULL)); PRINT_INT (sizeof (time_t)); time_t t = time (NULL); struct tm *now = localtime (&t); if (now == NULL) printf ("Could not get local time.\n"); PRINT_INT (now->tm_year); PRINT_INT (now->tm_mon); PRINT_INT (now->tm_mday); PRINT_INT (now->tm_hour); PRINT_INT (now->tm_min); PRINT_INT (now->tm_sec); return 0; } // main