#include <time.h>
#include <string.h>
#include <stdio.h>

/* taken from Dale Schumacher's dLibs library */

static char             timebuf[26];

static char             *day[] =
                        {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
static char             *month[] =
                        {"Jan", "Feb", "Mar", "Apr", "May", "Jun",
                        "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};


char *asctime(time)
        register const struct tm *time;
/*
 *      Convert <time> structure value to a string.  The same format, and
 *      the same internal buffer, as for ctime() is used for this function.
 */
        {
	if (time == NULL)
	     (void)strcpy(timebuf, "??? ??? ?? ??:??:?? ????\n");
	else
             (void)sprintf(timebuf, "%.3s %.3s%3d %02d:%02d:%02d %04d\n",
                day[time->tm_wday], month[time->tm_mon], time->tm_mday,
                time->tm_hour, time->tm_min, time->tm_sec, 1900+time->tm_year);
        return(timebuf);
        }

char *ctime(rawtime)
        const time_t *rawtime;
/*
 *      Convert <rawtime> to a string.  A 26 character fixed field string
 *      is created from the raw time value.  The following is an example
 *      of what this string might look like:
 *              "Wed Jul 08 18:43:07 1987\n\0"
 *      A 24-hour clock is used, and due to a limitation in the ST system
 *      clock value, only a resolution of 2 seconds is possible.  A pointer
 *      to the formatted string, which is held in an internal buffer, is
 *      returned.
 */
        {
        return(asctime(localtime(rawtime)));
        }
