Revision: | 2.8 |
Committed: | Fri Jun 27 06:53:21 2003 UTC (21 years, 10 months ago) by greg |
Content type: | text/plain |
Branch: | MAIN |
CVS Tags: | rad4R2P2, rad5R0, rad3R7P2, rad3R7P1, rad4R2, rad4R1, rad4R0, rad3R6, rad3R6P1, rad3R8, rad3R9, rad4R2P1 |
Changes since 2.7: | +3 -3 lines |
Log Message: | Broke standard.h into rtio.h, rterror.h, rtmath.h, and rtmisc.h |
# | User | Rev | Content |
---|---|---|---|
1 | greg | 2.1 | #ifndef lint |
2 | greg | 2.8 | static const char RCSid[] = "$Id: fdate.c,v 2.7 2003/06/08 12:03:09 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.7 | #ifdef _WIN32 |
15 | #include <sys/utime.h> | ||
16 | #else | ||
17 | #include <utime.h> | ||
18 | #endif | ||
19 | greg | 2.1 | |
20 | |||
21 | greg | 2.3 | time_t |
22 | greg | 2.1 | fdate(fname) /* get file date */ |
23 | char *fname; | ||
24 | { | ||
25 | struct stat sbuf; | ||
26 | |||
27 | if (stat(fname, &sbuf) == -1) | ||
28 | greg | 2.2 | return(0); |
29 | greg | 2.1 | |
30 | return(sbuf.st_mtime); | ||
31 | greg | 2.4 | } |
32 | |||
33 | |||
34 | int | ||
35 | setfdate(fname, ftim) /* set file date */ | ||
36 | char *fname; | ||
37 | long ftim; | ||
38 | { | ||
39 | schorsch | 2.7 | 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 | greg | 2.4 | time_t ftm[2]; |
46 | |||
47 | ftm[0] = ftm[1] = ftim; | ||
48 | return(utime(fname, ftm)); | ||
49 | schorsch | 2.7 | #endif |
50 | greg | 2.1 | } |