/* file_age.c, by SoD- * Shows the age of a file in hours. */ #include #include #include #include int main(int argc, char *argv[]) { struct stat filestats; if((argc != 2) || (stat(argv[1], &filestats) == -1)) { printf("-1\n"); exit(EXIT_FAILURE); } printf("%d\n", (int)(difftime(time(NULL), filestats.st_mtime) / 3600)); exit(EXIT_SUCCESS); }