size_t alt, i = scan_trans(t, local, &alt);
if (i != -1) {
*isdst = types[6*i+4];
- *offset = -(int32_t)zi_read32(types+6*i);
+ *offset = (int32_t)zi_read32(types+6*i);
*zonename = (const char *)abbrevs + types[6*i+5];
- if (oppoff) *oppoff = -(int32_t)zi_read32(types+6*alt);
+ if (oppoff) *oppoff = (int32_t)zi_read32(types+6*alt);
UNLOCK(lock);
return;
}
}
std:
*isdst = 0;
- *offset = __timezone;
- if (oppoff) *oppoff = dst_off;
+ *offset = -__timezone;
+ if (oppoff) *oppoff = -dst_off;
*zonename = __tzname[0];
UNLOCK(lock);
return;
dst:
*isdst = 1;
- *offset = dst_off;
- if (oppoff) *oppoff = __timezone;
+ *offset = -dst_off;
+ if (oppoff) *oppoff = -__timezone;
*zonename = __tzname[1];
UNLOCK(lock);
}
return 0;
}
__secs_to_zone(*t, 0, &tm->tm_isdst, &tm->__tm_gmtoff, 0, &tm->__tm_zone);
- if (__secs_to_tm((long long)*t - tm->__tm_gmtoff, tm) < 0) {
+ if (__secs_to_tm((long long)*t + tm->__tm_gmtoff, tm) < 0) {
errno = EOVERFLOW;
return 0;
}
__secs_to_zone(t, 1, &new.tm_isdst, &new.__tm_gmtoff, &opp, &new.__tm_zone);
if (tm->tm_isdst>=0 && new.tm_isdst!=tm->tm_isdst)
- t += opp - new.__tm_gmtoff;
+ t -= opp - new.__tm_gmtoff;
- t += new.__tm_gmtoff;
+ t -= new.__tm_gmtoff;
if ((time_t)t != t) goto error;
__secs_to_zone(t, 0, &new.tm_isdst, &new.__tm_gmtoff, &opp, &new.__tm_zone);
- if (__secs_to_tm(t - new.__tm_gmtoff, &new) < 0) goto error;
+ if (__secs_to_tm(t + new.__tm_gmtoff, &new) < 0) goto error;
*tm = new;
return t;
fmt = "%H:%M";
goto recu_strftime;
case 's':
- val = __tm_to_secs(tm) + tm->__tm_gmtoff;
+ val = __tm_to_secs(tm) - tm->__tm_gmtoff;
width = 1;
goto number;
case 'S':
return "";
}
*l = snprintf(*s, sizeof *s, "%+.2d%.2d",
- (-tm->__tm_gmtoff)/3600,
+ (tm->__tm_gmtoff)/3600,
abs(tm->__tm_gmtoff%3600)/60);
return *s;
case 'Z':