The standard way in ANSI C to detect errors when the return value is ambiguous is using `errno': { errno = 0; timet = mktime (&stm); if (timet == (time_t) -1 && errno != 0) perror ("mktime"); }