diff options
author | Florian Weimer <fweimer@redhat.com> | 2019-02-03 09:55:41 +0100 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2019-02-03 09:55:41 +0100 |
commit | 77c7d55ece0caaa39652e05158e18d8a9b4f6fbe (patch) | |
tree | c0ece835c04118e8af375a7eb875fdafeac21586 /time/tzset.c | |
parent | ee9941f94ea838774c34f60b3397fba07a803d92 (diff) | |
download | glibc-77c7d55ece0caaa39652e05158e18d8a9b4f6fbe.zip glibc-77c7d55ece0caaa39652e05158e18d8a9b4f6fbe.tar.gz glibc-77c7d55ece0caaa39652e05158e18d8a9b4f6fbe.tar.bz2 |
time: Use int, not long int, for internal GMT offsets
The GMT offset can be outside the range of a 16-bit int type, which
is presumably the reason why long int was used in struct tm. We
cannot change struct tm, but we can change the internal type for
the offset.
Diffstat (limited to 'time/tzset.c')
-rw-r--r-- | time/tzset.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/time/tzset.c b/time/tzset.c index d026674..307eb65 100644 --- a/time/tzset.c +++ b/time/tzset.c @@ -50,7 +50,7 @@ typedef struct unsigned short int m, n, d; /* Month, week, day. */ int secs; /* Time of day. */ - long int offset; /* Seconds east of GMT (west if < 0). */ + int offset; /* Seconds east of GMT (west if < 0). */ /* We cache the computed time of change for a given year so we don't have to recompute it. */ @@ -193,11 +193,11 @@ parse_offset (const char **tzp, int whichrule) && (*tz == '\0' || (*tz != '+' && *tz != '-' && !isdigit (*tz)))) return false; - long sign; + int sign; if (*tz == '-' || *tz == '+') - sign = *tz++ == '-' ? 1L : -1L; + sign = *tz++ == '-' ? 1 : -1; else - sign = -1L; + sign = -1; *tzp = tz; unsigned short int hh; |