mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-13 00:30:07 +00:00
tzset: Clean up preprocessor macros min, max, sign
This commit is contained in:
parent
8492c4dd69
commit
6e3b52292a
@ -1,3 +1,10 @@
|
|||||||
|
2017-03-07 Florian Weimer <fweimer@redhat.com>
|
||||||
|
|
||||||
|
* time/tzset.c (compute_offset): Open-code min macro.
|
||||||
|
(min, max, sign): Remove.
|
||||||
|
|
||||||
|
2017-03-07 Florian Weimer <fweimer@redhat.com>
|
||||||
|
|
||||||
2017-03-07 Florian Weimer <fweimer@redhat.com>
|
2017-03-07 Florian Weimer <fweimer@redhat.com>
|
||||||
|
|
||||||
[BZ #15576]
|
[BZ #15576]
|
||||||
@ -12,6 +19,7 @@
|
|||||||
(tzset_internal): Remove argument.
|
(tzset_internal): Remove argument.
|
||||||
(__tzset): Adjust call to tzset_internal.
|
(__tzset): Adjust call to tzset_internal.
|
||||||
(__tz_convert): Likewise.
|
(__tz_convert): Likewise.
|
||||||
|
|
||||||
* posix/sysconf.c (__sysconf): Return -1 for _SC_TZNAME_MAX.
|
* posix/sysconf.c (__sysconf): Return -1 for _SC_TZNAME_MAX.
|
||||||
* sysdeps/posix/sysconf.c (__sysconf): Likewise.
|
* sysdeps/posix/sysconf.c (__sysconf): Likewise.
|
||||||
* manual/conf.texi (Sysconf Definition): Update comment.
|
* manual/conf.texi (Sysconf Definition): Update comment.
|
||||||
|
14
time/tzset.c
14
time/tzset.c
@ -38,12 +38,6 @@ weak_alias (__timezone, timezone)
|
|||||||
/* This locks all the state variables in tzfile.c and this file. */
|
/* This locks all the state variables in tzfile.c and this file. */
|
||||||
__libc_lock_define_initialized (static, tzset_lock)
|
__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
|
/* This structure contains all the information about a
|
||||||
timezone given in the POSIX standard TZ envariable. */
|
timezone given in the POSIX standard TZ envariable. */
|
||||||
typedef struct
|
typedef struct
|
||||||
@ -142,7 +136,13 @@ update_vars (void)
|
|||||||
static unsigned int
|
static unsigned int
|
||||||
compute_offset (unsigned int ss, unsigned int mm, unsigned int hh)
|
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
|
/* Parses the time zone name at *TZP, and writes a pointer to an
|
||||||
|
Loading…
Reference in New Issue
Block a user