Files
amiga-tz/asctime.c
T

48 lines
913 B
C
Raw Normal View History

1986-12-31 14:22:18 -05:00
#
/*LINTLIBRARY*/
#include "stdio.h"
1988-02-17 20:07:35 -05:00
#ifndef lint
#ifndef NOID
1988-02-16 22:44:07 -05:00
static char elsieid[] = "%W%"
1988-02-17 20:07:35 -05:00
#endif /* !defined NOID */
#endif /* !defined lint */
1986-12-31 14:22:18 -05:00
#include "time.h"
1986-12-31 16:13:33 -05:00
#include "tzfile.h"
1986-12-31 14:22:18 -05:00
1988-02-17 20:07:35 -05:00
#ifndef __STDC__
1988-02-16 22:44:07 -05:00
#define const
1988-02-17 20:07:35 -05:00
#ifndef USG
1986-12-31 14:22:18 -05:00
extern char * sprintf();
1988-02-16 22:44:07 -05:00
#endif /* !defined USG */
#endif /* !defined __STDC__ */
1986-12-31 14:22:18 -05:00
/*
** A la X3J11
*/
char *
asctime(timeptr)
1988-02-16 22:44:07 -05:00
register const struct tm * timeptr;
1986-12-31 14:22:18 -05:00
{
1987-01-01 13:39:00 -05:00
static char wday_name[DAYS_PER_WEEK][3] = {
1986-12-31 14:22:18 -05:00
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
};
1987-01-01 14:52:36 -05:00
static char mon_name[MONS_PER_YEAR][3] = {
1986-12-31 14:22:18 -05:00
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
};
static char result[26];
1987-04-12 13:01:27 -04:00
(void) sprintf(result, "%.3s %.3s%3d %02.2d:%02.2d:%02.2d %d\n",
1986-12-31 14:22:18 -05:00
wday_name[timeptr->tm_wday],
mon_name[timeptr->tm_mon],
timeptr->tm_mday, timeptr->tm_hour,
timeptr->tm_min, timeptr->tm_sec,
TM_YEAR_BASE + timeptr->tm_year);
return result;
}