|
|
1.1 root 1:
2: /*
3: * getdate.c -- fill a buffer with the date and time
4: */
5:
6: #include <time.h>
7:
8: getdate (p)
9:
10: char *p;
11:
12: {
13: long tod;
14: register struct tm *tm;
15: struct tm *localtime();
16:
17: time (&tod);
18: tm = localtime (&tod);
19:
20: conv (p, tm->tm_mon+1);
21: p[2] = '/';
22: conv (p+3, tm->tm_mday);
23: p[5] = '/';
24: conv (p+6, tm->tm_year);
25: p[8] = ' ';
26: conv (p+9, tm->tm_hour);
27: p[11] = '.';
28: conv (p+12, tm->tm_min);
29: p[14] = '.';
30: conv (p+15, tm->tm_sec);
31: }
32:
33: static
34: conv (dest, value)
35:
36: register char *dest;
37: register int value;
38:
39: {
40: dest[1] = value % 10 + '0';
41: dest[0] = value / 10 + '0';
42: }
43:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.