|
|
1.1 root 1: #include "parms.h"
2: #include "structs.h"
3:
4: #ifdef RCSIDENT
5: static char rcsid[] = "$Header: gtime.c,v 1.7 85/01/18 15:12:21 notes Rel $";
6: #endif RCSIDENT
7:
8: /*
9: * gettime(whenvec) struct when_f *whenvec; {}
10: *
11: * fills in whenvec with the most uptodate time
12: *
13: * Rob Kolstad Winter 1980
14: * Modified to split getting and formatting time
15: * Malcolm Slaney March 1983
16: */
17:
18: /*
19: * 4.2 Bsd moved the file!
20: */
21: #ifndef BSD42
22: #include <time.h>
23: #else
24: #include <sys/time.h>
25: #endif !BSD42
26:
27: gettime (whenvec) struct when_f *whenvec;
28: {
29: long tvec;
30:
31: time (&tvec); /* get the funky number */
32: return (maketime (whenvec, tvec));
33: }
34:
35: maketime (whenvec, tvec)
36: struct when_f *whenvec;
37: long tvec;
38: {
39: struct tm *ovec;
40: struct tm *localtime ();
41: ovec = localtime (&tvec); /* convert to local time */
42: whenvec -> w_mins = ovec -> tm_min;
43: whenvec -> w_hours = ovec -> tm_hour;
44: whenvec -> w_day = ovec -> tm_mday;
45: whenvec -> w_month = ovec -> tm_mon + 1; /* jan= 0 as supplied, correct it */
46: whenvec -> w_year = ovec -> tm_year + 1900; /* all from CTIME (III) */
47: whenvec -> w_gmttime = tvec;
48: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.