diff options
author | Florian Weimer <fweimer@redhat.com> | 2017-03-07 10:39:00 +0100 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2017-03-07 17:45:39 +0100 |
commit | 6e3b52292a042ede4d053054a895167afd6edcf2 (patch) | |
tree | 46655351ed5d0dd234867bfc4f939a4e5e82bcbe /time/tzset.c | |
parent | timezone: Remove TZNAME_MAX limit from sysconf [BZ #15576] (diff) | |
download | glibc-6e3b52292a042ede4d053054a895167afd6edcf2.tar.gz glibc-6e3b52292a042ede4d053054a895167afd6edcf2.tar.bz2 glibc-6e3b52292a042ede4d053054a895167afd6edcf2.zip |
tzset: Clean up preprocessor macros min, max, sign
Diffstat (limited to 'time/tzset.c')
-rw-r--r-- | time/tzset.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/time/tzset.c b/time/tzset.c index f0e5c95e82..8868e9aada 100644 --- a/time/tzset.c +++ b/time/tzset.c @@ -38,12 +38,6 @@ weak_alias (__timezone, timezone) /* This locks all the state variables in tzfile.c and this file. */ __libc_lock_define_initialized (static, tzset_lock) - -#define min(a, b) ((a) < (b) ? (a) : (b)) -#define max(a, b) ((a) > (b) ? (a) : (b)) -#define sign(x) ((x) < 0 ? -1 : 1) - - /* This structure contains all the information about a timezone given in the POSIX standard TZ envariable. */ typedef struct @@ -142,7 +136,13 @@ update_vars (void) static unsigned int compute_offset (unsigned int ss, unsigned int mm, unsigned int hh) { - return min (ss, 59) + min (mm, 59) * 60 + min (hh, 24) * 60 * 60; + if (ss > 59) + ss = 59; + if (mm > 59) + mm = 59; + if (hh > 24) + hh = 24; + return ss + mm * 60 + hh * 60 * 60; } /* Parses the time zone name at *TZP, and writes a pointer to an |