ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/fdate.c
Revision: 2.9
Committed: Sun Mar 6 01:13:17 2016 UTC (8 years, 1 month ago) by schorsch
Content type: text/plain
Branch: MAIN
CVS Tags: rad5R2, rad5R1
Changes since 2.8: +2 -2 lines
Log Message:
Prepare for SCons build on Win32 and Win64

File Contents

# Content
1 #ifndef lint
2 static const char RCSid[] = "$Id: fdate.c,v 2.8 2003/06/27 06:53:21 greg Exp $";
3 #endif
4 /*
5 * Return file date (UNIX seconds as returned by time(2) call)
6 *
7 * External symbols declared in rtio.h
8 */
9
10 #include "copyright.h"
11
12 #include "rtio.h"
13 #include <sys/stat.h>
14 #if defined(_WIN32) || defined(_WIN64)
15 #include <sys/utime.h>
16 #else
17 #include <utime.h>
18 #endif
19
20
21 time_t
22 fdate(fname) /* get file date */
23 char *fname;
24 {
25 struct stat sbuf;
26
27 if (stat(fname, &sbuf) == -1)
28 return(0);
29
30 return(sbuf.st_mtime);
31 }
32
33
34 int
35 setfdate(fname, ftim) /* set file date */
36 char *fname;
37 long ftim;
38 {
39 struct utimbuf utb;
40
41 utb.actime = utb.modtime = ftim;
42 return(utime(fname, &utb));
43
44 #ifdef NOTHING /* XXX does this work anywhere? */
45 time_t ftm[2];
46
47 ftm[0] = ftm[1] = ftim;
48 return(utime(fname, ftm));
49 #endif
50 }