bug fixes
This commit is contained in:
parent
ce3981e051
commit
70a44a040d
@ -2,16 +2,16 @@
|
|||||||
|
|
||||||
static int monthsize[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
|
static int monthsize[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
|
||||||
|
|
||||||
#define SECS_DAY 24*60L*60L
|
#define SECS_DAY (24*60L*60L)
|
||||||
#define YEARSIZE(year) ((year) % 4 ? 365 : 366)
|
#define YEARSIZE(year) ((year) % 4 ? 365 : 366)
|
||||||
|
|
||||||
struct tm *
|
struct tm *
|
||||||
gmtime(clock)
|
gmtime(clock)
|
||||||
long *clock;
|
long *clock;
|
||||||
{
|
{
|
||||||
unsigned long cl = *clock;
|
long cl = *clock;
|
||||||
long dayclock, dayno;
|
long dayclock, dayno;
|
||||||
struct tm tm_buf;
|
static struct tm tm_buf;
|
||||||
register struct tm *pbuf = &tm_buf;
|
register struct tm *pbuf = &tm_buf;
|
||||||
register int *months = monthsize;
|
register int *months = monthsize;
|
||||||
int year = 1970;
|
int year = 1970;
|
||||||
@ -27,7 +27,7 @@ gmtime(clock)
|
|||||||
dayno -= YEARSIZE(year);
|
dayno -= YEARSIZE(year);
|
||||||
year++;
|
year++;
|
||||||
}
|
}
|
||||||
pbuf->tm_year = year;
|
pbuf->tm_year = year - 1900;
|
||||||
pbuf->tm_yday = dayno;
|
pbuf->tm_yday = dayno;
|
||||||
pbuf->tm_isdst = 0;
|
pbuf->tm_isdst = 0;
|
||||||
if (YEARSIZE(year) == 366) monthsize[1] = 29;
|
if (YEARSIZE(year) == 366) monthsize[1] = 29;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user