diff --git a/xen/common/time.c b/xen/common/time.c index c873b5731b..04a65f00b3 100644 --- a/xen/common/time.c +++ b/xen/common/time.c @@ -45,7 +45,8 @@ static DEFINE_SPINLOCK(wc_lock); struct tm gmtime(unsigned long t) { struct tm tbuf; - long days, rem; + unsigned long days; + unsigned int rem; int y; const unsigned short int *ip; @@ -70,18 +71,11 @@ struct tm gmtime(unsigned long t) tbuf.tm_sec = rem % 60; /* January 1, 1970 was a Thursday. */ tbuf.tm_wday = (4 + days) % 7; - if ( tbuf.tm_wday < 0 ) - tbuf.tm_wday += 7; while ( days >= (rem = __isleap(y) ? 366 : 365) ) { ++y; days -= rem; } - while ( days < 0 ) - { - --y; - days += __isleap(y) ? 366 : 365; - } tbuf.tm_year = y - 1900; tbuf.tm_yday = days; /* SAF-14-safe use boolean as an array index */