Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 1908 → Rev 3065

/programs/develop/libraries/newlib/time/asctime_r.c
18,7 → 18,7
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
};
 
sprintf (result, "%.3s %.3s%3d %.2d:%.2d:%.2d %d\n",
siprintf (result, "%.3s %.3s%3d %.2d:%.2d:%.2d %d\n",
day_name[tim_p->tm_wday],
mon_name[tim_p->tm_mon],
tim_p->tm_mday, tim_p->tm_hour, tim_p->tm_min,
/programs/develop/libraries/newlib/time/mktime.c
107,7 → 107,7
}
}
 
if (tim_p->tm_mon > 11)
if (tim_p->tm_mon < 0 || tim_p->tm_mon > 11)
{
res = div (tim_p->tm_mon, 12);
tim_p->tm_year += res.quot;
159,7 → 159,7
{
time_t tim = 0;
long days = 0;
int year, isdst, tm_isdst;
int year, isdst=0;
__tzinfo_type *tz = __gettzinfo ();
 
/* validate structure */
178,19 → 178,16
/* compute day of the year */
tim_p->tm_yday = days;
 
if (tim_p->tm_year > 10000
|| tim_p->tm_year < -10000)
{
if (tim_p->tm_year > 10000 || tim_p->tm_year < -10000)
return (time_t) -1;
}
 
/* compute days in other years */
if (tim_p->tm_year > 70)
if ((year = tim_p->tm_year) > 70)
{
for (year = 70; year < tim_p->tm_year; year++)
days += _DAYS_IN_YEAR (year);
}
else if (tim_p->tm_year < 70)
else if (year < 70)
{
for (year = 69; year > tim_p->tm_year; year--)
days -= _DAYS_IN_YEAR (year);
197,20 → 194,19
days -= _DAYS_IN_YEAR (year);
}
 
/* compute day of the week */
if ((tim_p->tm_wday = (days + 4) % 7) < 0)
tim_p->tm_wday += 7;
 
/* compute total seconds */
tim += (days * _SEC_IN_DAY);
 
TZ_LOCK;
 
if (_daylight)
{
int tm_isdst;
int y = tim_p->tm_year + YEAR_BASE;
/* Convert user positive into 1 */
tm_isdst = tim_p->tm_isdst > 0 ? 1 : tim_p->tm_isdst;
isdst = tm_isdst;
 
if (_daylight)
{
int y = tim_p->tm_year + YEAR_BASE;
if (y == tz->__tzyear || __tzcalc_limits (y))
{
/* calculate start of dst in dst local time and
244,12 → 240,33
if (!isdst)
diff = -diff;
tim_p->tm_sec += diff;
tim += diff; /* we also need to correct our current time calculation */
int mday = tim_p->tm_mday;
validate_structure (tim_p);
tim += diff; /* we also need to correct our current time calculation */
mday = tim_p->tm_mday - mday;
/* roll over occurred */
if (mday) {
/* compensate for month roll overs */
if (mday > 1)
mday = -1;
else if (mday < -1)
mday = 1;
/* update days for wday calculation */
days += mday;
/* handle yday */
if ((tim_p->tm_yday += mday) < 0) {
--year;
tim_p->tm_yday = _DAYS_IN_YEAR(year) - 1;
} else {
mday = _DAYS_IN_YEAR(year);
if (tim_p->tm_yday > (mday - 1))
tim_p->tm_yday -= mday;
}
}
}
}
}
}
 
/* add appropriate offset to put time in gmt format */
if (isdst == 1)
257,8 → 274,14
else /* otherwise assume std time */
tim += (time_t) tz->__tzrule[0].offset;
 
TZ_UNLOCK;
 
/* reset isdst flag to what we have calculated */
tim_p->tm_isdst = isdst;
 
/* compute day of the week */
if ((tim_p->tm_wday = (days + 4) % 7) < 0)
tim_p->tm_wday += 7;
return tim;
}
/programs/develop/libraries/newlib/time/mktm_r.c
182,7 → 182,7
{
res->tm_mon = 11;
res->tm_year -= 1;
res->tm_yday = 365 + isleap(res->tm_year);
res->tm_yday = 364 + isleap(res->tm_year + 1900);
}
res->tm_mday = ip[res->tm_mon];
}
216,10 → 216,13
for (i = 0; i < 2; ++i)
{
if (tz->__tzrule[i].ch == 'J')
if (tz->__tzrule[i].ch == 'J') {
/* The Julian day n (1 <= n <= 365). */
days = year_days + tz->__tzrule[i].d +
(isleap(year) && tz->__tzrule[i].d >= 60);
else if (tz->__tzrule[i].ch == 'D')
/* Convert to yday */
--days;
} else if (tz->__tzrule[i].ch == 'D')
days = year_days + tz->__tzrule[i].d;
else
{
254,4 → 257,3
 
return 1;
}