--- ray/src/common/fdate.c 1993/03/10 19:39:54 2.1 +++ ray/src/common/fdate.c 2003/06/08 12:03:09 2.7 @@ -1,25 +1,50 @@ -/* Copyright (c) 1993 Regents of the University of California */ - #ifndef lint -static char SCCSid[] = "$SunId$ LBL"; +static const char RCSid[] = "$Id: fdate.c,v 2.7 2003/06/08 12:03:09 schorsch Exp $"; #endif - /* * Return file date (UNIX seconds as returned by time(2) call) + * + * External symbols declared in standard.h */ +#include "copyright.h" + #include #include +#ifdef _WIN32 + #include +#else + #include +#endif -long +time_t fdate(fname) /* get file date */ char *fname; { struct stat sbuf; if (stat(fname, &sbuf) == -1) - return(-1); + return(0); return(sbuf.st_mtime); +} + + +int +setfdate(fname, ftim) /* set file date */ +char *fname; +long ftim; +{ + struct utimbuf utb; + + utb.actime = utb.modtime = ftim; + return(utime(fname, &utb)); + +#ifdef NOTHING /* XXX does this work anywhere? */ + time_t ftm[2]; + + ftm[0] = ftm[1] = ftim; + return(utime(fname, ftm)); +#endif }