home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
World_Of_Computer_Software-02-387-Vol-3of3.iso
/
c
/
cuj9301.zip
/
1101118B
< prev
next >
Wrap
Text File
|
1992-11-03
|
587b
|
31 lines
/* ftime.c: Compare file time stamps */
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <time.h>
main()
{
struct stat fs1, fs2;
if (stat("time1.c",&fs1) == 0 &&
stat("time2.c",&fs2) == 0)
{
double interval =
difftime(fs2.st_mtime,fs1.st_mtime);
printf("time1.c %s newer than time2.c\n",
(interval < 0.0) ? "is" : "is not");
return EXIT_SUCCESS;
}
else
return EXIT_FAILURE;
}
/* Output
time1.c is not newer than time2.c
*/
/* End of File */