|
|
1.1 root 1: #include <sys/types.h>
2: #include <sys/timeb.h>
3: #include <time.h>
4:
5: extern long time();
6: extern char *timezone();
7: extern struct tm *localtime();
8: extern char *asctime();
9:
10: /*
11: * return an ascii daytime string
12: */
13: extern char *
14: thedate()
15: {
16: static char date[32];
17: char *tp, *dp;
18: struct timeb timbuf;
19: struct tm *bp;
20: long thetime;
21:
22: thetime = time((long *)0);
23: bp = localtime(&thetime);
24: dp = asctime(bp);
25: ftime(&timbuf);
26: tp = timezone(timbuf.timezone, bp->tm_isdst ? 1 : 0);
27: sprintf(date, "%.19s %.3s %.4s", dp, tp, dp+20);
28: return date;
29: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.