1
0
mirror of https://frontier.innolan.net/rainlance/amiga-tz.git synced 2025-11-23 03:12:27 +00:00
Files
amiga-tz/asctime.c
Arthur David Olson d0498e791a ANSI
SCCS-file: asctime.c
SCCS-SID: 3.3
2012-07-18 03:01:46 -04:00

46 lines
922 B
C

#
/*LINTLIBRARY*/
#include "stdio.h"
#if !defined lint && !defined NOID
static char elsieid[] = "%W%"
#endif /* !defined lint && !defined NOID */
#include "time.h"
#include "tzfile.h"
#if !defined __STDC__
#define const
#if !defined USG
extern char * sprintf();
#endif /* !defined USG */
#endif /* !defined __STDC__ */
/*
** A la X3J11
*/
char *
asctime(timeptr)
register const struct tm * timeptr;
{
static char wday_name[DAYS_PER_WEEK][3] = {
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
};
static char mon_name[MONS_PER_YEAR][3] = {
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
};
static char result[26];
(void) sprintf(result, "%.3s %.3s%3d %02.2d:%02.2d:%02.2d %d\n",
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;
}