* Copyright (c) 1990 The Regents of the University of California.
* %sccs.include.redist.c%
static char sccsid
[] = "@(#)pr_time.c 5.2 (Berkeley) %G%";
* prttime prints a time in hours and minutes or minutes and seconds.
* The character string tail is printed at the end, obvious
* strings to pass are "", " ", or "am".
(void) sprintf(timebuf
, "%2d:%02d%s", (int)(tim
/ 60), mins
,
(void) sprintf(timebuf
, " %2d%s", (int)tim
, tail
);
(void) strcpy(timebuf
, tail
);
static char *weekday
[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
static char *month
[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
/* prtat prints a 12 hour time given a pointer to a time of day */
if (now
- *started
<= 18 * HR
)
return (prttime((time_t)hr
* 60 + p
->tm_min
, pm
? "pm" : "am"));
if (now
- *started
<= 7 * DAY
)
(void) sprintf(prbuff
, "%*s%d%s", hr
< 10 ? 4 : 3,
weekday
[p
->tm_wday
], hr
, pm
? "pm" : "am");
(void) sprintf(prbuff
, "%2d%s%2d", p
->tm_mday
,
month
[p
->tm_mon
], p
->tm_year
);