]>
diplodocus.org Git - nmh/blob - docs/historical/mh-nov-1983/subs/putdate.c
7 * Output the date in right format gotten from
8 * the passed ctime(3) format date.
9 * If the passed date is NULL, output the current
17 register char *t
, *p
, *cp
;
20 struct tm
*localtime();
25 static char *str
= "SunMonTueWedThuFriSat";
26 static char *daytag
[] = {
36 now
= time((long *) 0);
37 tmp
= localtime(&now
);
38 isdst
= tmp
->tm_isdst
;
40 timestr
= asctime(tmp
);
44 if (strcmpn(cp
, t
, 3) == 0)
49 cp
= daytag
[(cp
- str
) / 3];
54 * This call to timezone() may be wrong:
55 * really need the tm_isdst whoever generated timestr.
57 p
= timezone(tb
.timezone
, isdst
);
60 fprintf(out
, "Date: %.2s %.3s %.4s %.2s%.2s-%.3s\n",
61 t
+8, t
+4, t
+20, t
+11, t
+14, p
);
63 fprintf(out
, "Date: %.2s %.3s %.4s %.2s%.2s-%.3s (%s)\n",
64 t
+8, t
+4, t
+20, t
+11, t
+14, p
, cp
);