ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/fdate.c
Revision: 2.4
Committed: Mon Oct 24 13:47:25 1994 UTC (29 years, 6 months ago) by greg
Content type: text/plain
Branch: MAIN
Changes since 2.3: +14 -1 lines
Log Message:
added setfdate function

File Contents

# User Rev Content
1 greg 2.4 /* Copyright (c) 1994 Regents of the University of California */
2 greg 2.1
3     #ifndef lint
4     static char SCCSid[] = "$SunId$ LBL";
5     #endif
6    
7     /*
8     * Return file date (UNIX seconds as returned by time(2) call)
9     */
10    
11     #include <sys/types.h>
12     #include <sys/stat.h>
13    
14    
15 greg 2.3 time_t
16 greg 2.1 fdate(fname) /* get file date */
17     char *fname;
18     {
19     struct stat sbuf;
20    
21     if (stat(fname, &sbuf) == -1)
22 greg 2.2 return(0);
23 greg 2.1
24     return(sbuf.st_mtime);
25 greg 2.4 }
26    
27    
28     int
29     setfdate(fname, ftim) /* set file date */
30     char *fname;
31     long ftim;
32     {
33     time_t ftm[2];
34    
35     ftm[0] = ftm[1] = ftim;
36    
37     return(utime(fname, ftm));
38 greg 2.1 }