/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Copyright (c) 1980 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*/
/*
* This localtime is a modified version of offtime from libc, which does not
* bother to figure out the time zone from the kernel, from environment
* variables, or from Unix files.
*/
#include <tzfile.h>
#include <errno.h>
31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31,
31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
};
};
struct tm *
{
long days;
long rem;
int y;
int yleap;
int *ip;
while (rem < 0) {
rem += SECS_PER_DAY;
--days;
}
while (rem >= SECS_PER_DAY) {
rem -= SECS_PER_DAY;
++days;
}
y = EPOCH_YEAR;
if (days >= 0) {
for (;;) {
break;
if (++y > 9999) {
return (NULL);
}
}
} else {
do {
if (--y < 0) {
return (NULL);
}
} while (days < 0);
}
return (tmp);
}
/*
* So is ctime...
*/
/*
* This routine converts time as follows.
* The epoch is 0000 Jan 1 1970 GMT.
* The argument time is in seconds since then.
* The localtime(t) entry returns a pointer to an array
* containing
* seconds (0-59)
* minutes (0-59)
* hours (0-23)
* day of month (1-31)
* month (0-11)
* year-1970
* weekday (0-6, Sun is 0)
* day of the year
* daylight savings flag
*
* The routine corrects for daylight saving
* time and will work in any time zone provided
* "timezone" is adjusted to the difference between
* Greenwich and local standard time (measured in seconds).
* In places like Michigan "daylight" must
* be initialized to 0 to prevent the conversion
* to daylight time.
* There is a table which accounts for the peculiarities
* undergone by daylight time in 1974-1975.
*
* The routine does not work
* in Saudi Arabia which runs on Solar time.
*
* asctime(tvec)
* where tvec is produced by localtime
* returns a ptr to a character string
* that has the ascii time in the form
* Thu Jan 01 00:00:00 1970\n\0
* 01234567890123456789012345
* 0 1 2
*
* ctime(t) just calls localtime, then asctime.
*
* tzset() looks for an environment variable named
* TZ.
* If the variable is present, it will set the external
* variables "timezone", "altzone", "daylight", and "tzname"
* appropriately. It is called by localtime, and
* may also be called explicitly by the user.
*/
static char *ct_numb();
/*
* POSIX.1c standard version of the function asctime_r.
* User gets it via static asctime_r from the header file.
*/
char *
{
const char *ncp;
const int *tp;
char *cp;
if (t == NULL)
return (NULL);
;
cp++;
if (t->tm_year > 9999) {
return (NULL);
} else {
}
cp += 2;
return (cbuf);
}
/*
* POSIX.1c Draft-6 version of the function asctime_r.
* It was implemented by Solaris 2.3.
*/
char *
{
return (NULL);
}
return (__posix_asctime_r(t, cbuf));
}
char *
{
}
char *
{
}
static char *
{
cp++;
if (n >= 10)
else
return (cp);
}