static char *sccsid
= "@(#)unctime.c 1.1 (Berkeley) %G%";
* Convert a ctime(3) format string into a system format date.
* Return the date thus calculated.
* Return -1 if the string is not in ctime format.
* Offsets into the ctime string to various parts.
if ( (then
.tm_mon
= lookup(&dbuf
[E_MONTH
])) < 0)
then
.tm_mday
= atoi(&dbuf
[E_DAY
]);
then
.tm_hour
= atoi(&dbuf
[E_HOUR
]);
then
.tm_min
= atoi(&dbuf
[E_MINUTE
]);
then
.tm_sec
= atoi(&dbuf
[E_SECOND
]);
then
.tm_year
= atoi(&dbuf
[E_YEAR
]) - 1900;
"JanFebMarAprMayJunJulAugSepOctNovDec";
for (cp
= months
, cp2
= str
; *cp
!= 0; cp
+= 3)
if (strncmp(cp
, cp2
, 3) == 0)
* Routine to convert a localtime(3) format date back into
for (i
= 31; i
>= 0; i
--) {
if (dcmp(localtime(&conv
), dp
) > 0)
* Compare two localtime dates, return result.
register struct tm
*dp
, *dp2
;