ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/fdate.c
Revision: 2.10
Committed: Wed Feb 27 21:30:01 2019 UTC (5 years, 2 months ago) by greg
Content type: text/plain
Branch: MAIN
CVS Tags: rad5R3
Changes since 2.9: +11 -15 lines
Log Message:
Removed unused code and added arguments to function definitions

File Contents

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