summaryrefslogtreecommitdiff
path: root/src/time/__tz.c
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2015-08-13 17:28:39 +0200
committerRich Felker <dalias@aerifal.cx>2015-08-14 00:47:46 +0000
commitc13f2af1fe1856e36dd1b2773cac05d5d72641dc (patch)
tree4c37476636be82f48d057379699f896433f18d9e /src/time/__tz.c
parente5b086e1d5fe52bf1553357ee790de86eda27bf1 (diff)
downloadmusl-c13f2af1fe1856e36dd1b2773cac05d5d72641dc.tar.gz
match historical behavior for tm_gmtoff member of struct tm
tm_gmtoff is a nonstandard field, but on historical systems which have this field, it stores the offset of the local time zone from GMT or UTC. this is the opposite of the POSIX extern long timezone object and the offsets used in POSIX-form TZ strings, which represent the offset from local time to UTC. previously we were storing these negated offsets in tm_gmtoff too. programs which only used this field indirectly via strftime were not affected since strftime performed the negation for presentation. however, some programs and libraries accesse tm_gmtoff directly and were obtaining negated time zone offsets.
Diffstat (limited to 'src/time/__tz.c')
-rw-r--r--src/time/__tz.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/time/__tz.c b/src/time/__tz.c
index 102c8bc7..8b84b9bd 100644
--- a/src/time/__tz.c
+++ b/src/time/__tz.c
@@ -354,9 +354,9 @@ void __secs_to_zone(long long t, int local, int *isdst, long *offset, long *oppo
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;
}
@@ -390,15 +390,15 @@ void __secs_to_zone(long long t, int local, int *isdst, long *offset, long *oppo
}
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);
}