home *** CD-ROM | disk | FTP | other *** search
- /*
- * DATE.C
- */
-
- #include <string.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <time.h>
- #include "config.h"
-
- Prototype char *atime (time_t *);
-
- char *
- atime (time_t *pt)
- {
- static char
- *TimeZoneName = NULL,
- buf [40],
- *mo [12] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
- "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" },
- *dow [7] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
- struct tm
- *ut = localtime (pt);
-
- if (TimeZoneName == NULL)
- TimeZoneName = FindConfig ("TimeZone");
-
- sprintf (buf, "%s, %d %s %02d %02d:%02d:%02d %s",
- dow [ut->tm_wday], ut->tm_mday, mo [ut->tm_mon],
- ut->tm_year % 100, ut->tm_hour, ut->tm_min, ut->tm_sec,
- TimeZoneName
- );
-
- return buf;
- }
-