This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[RFC v4 07/24] time: Deprecate struct timezone members
- From: Alistair Francis <alistair dot francis at wdc dot com>
- To: libc-alpha at sourceware dot org
- Cc: arnd at arndb dot de, adhemerval dot zanella at linaro dot org, fweimer at redhat dot com, palmer at sifive dot com, macro at wdc dot com, zongbox at gmail dot com, alistair dot francis at wdc dot com, alistair23 at gmail dot com
- Date: Fri, 9 Aug 2019 18:00:05 -0700
- Subject: [RFC v4 07/24] time: Deprecate struct timezone members
- Ironport-sdr: Ytb/kL0AWlmatp1laClgbccDe/cONWq3NNzvsJm6P5p4PcvzvXWHszeGq9grrq3WvDOvWqpEcc L+oJ862Yvos7TDYcnug/qJjDr8BXekBPrTFX7DjiMlt2cWUdokRvC7vAO0XJPqW9+k6xQ4kV8Y BpDAXWa/OvV3cS9Fk33OgP6AVKQiXQVU1Lla+jWlowxjIjH6iEp+5OaIHbRNkg+168/BCOIPoJ s7Yw0ukdRzim3rO0qZtMX09tp0i1G2soHMWgUBl1pA1PfdiDE7DiCjHpcW1HayxI8kqb86rCcw 3kM=
- Ironport-sdr: Xu9UPjVBORHdXeCFr1uwA2elZn4ML+oU/AkGURy8+aE8m/oaccZo1Gvl6d1Z3d73O1ojHOmQta 9Nyp6UAexzedP8Km8ReMiPWG+upbQalQu6Sd5XNSITqHuVmQkWM5d6+a8DuNvxu58Y8auY+LN7 5A0PWnvEwo11g3OOLRc2GtEjYlNggK5OQzBDC2BgByu12UOIadm2XKBxT5Vo4eMDSDQwBJhOBS uo9Nwv8IeLHI+nlMQJOY1DTLzpYaJwreOZK6Zv3OAdwuSUBf8FDYybAhMUgRPmjWuJ3nyVkrRy nhdNLdPqORg/xrWuq+02YOGj
- Ironport-sdr: 0oHWlj9wulQym83j1idjtWMA+aP2f82olefc63jsyYXtgm4N4zHZF3m6F6K2blTGS8wsQifTlV 3md48xBm6RgWW2uVKAISXdjmTN91bzdI7JDw4hdMJY7so9h9beapHL8N6mhIwKQWqfntNUhgG7 uSxPrhMr/Si5ySkUPn7E5WeT6eTgU4k6AZz7eTH0+o9sTBn9aG8OD02AUnw7Aub2J5Z6v8igXk YF9WyG4yMJn5Jz62hZgw3ukD8NqFZQk5txsLU1O8Lrpy2+OAHsWx3sijsFh1PXdFO9V5fODwxa 8Tw=
- References: <cover.1565398513.git.alistair.francis@wdc.com>
Append the struct timezone members with '_dep'. This indicates that
these members are deprecated and will cause build failures on code that
is currently using the members.
The struct timezone *tz variable contaions information on the current
timezone, in this structure:
struct timezone {
int tz_minuteswest; /* minutes west of Greenwich */
int tz_dsttime; /* type of DST correction */
};
The members are being renamed to create compilation failures for anyone
who is using them. This is being done for the following reasons.
On 32-bit systems with __ARCH_WANT_TIME32_SYSCALLS not defined there is
no way way to get the struct timezone via a syscall. AFAIK there are no
plans to add suppor to a future kernel.
The Linux documentation says that "The use of the timezone structure
is obsolete; the tz argument should normally be specified as NULL."
Most callers of gettimeofday() don't use the timezone data, see
example code from Debian below.
If __ASSUME_TIME64_SYSCALLS and __NR_clock_gettime64 are not defined
then struct timezone *tz will be set as usual.
Example code from Debian:
struct timeval my_gettime(void)
{
struct timezone tz_ignored;
struct timeval tv;
gettimeofday(&tv, &tz_ignored);
return tv;
}
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
---
sysdeps/unix/bsd/ftime.c | 4 ++--
time/sys/time.h | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/sysdeps/unix/bsd/ftime.c b/sysdeps/unix/bsd/ftime.c
index 3a1c6e9b01c..bc4dfdab945 100644
--- a/sysdeps/unix/bsd/ftime.c
+++ b/sysdeps/unix/bsd/ftime.c
@@ -34,7 +34,7 @@ ftime (struct timeb *timebuf)
++timebuf->time;
timebuf->millitm = 0;
}
- timebuf->timezone = tz.tz_minuteswest;
- timebuf->dstflag = tz.tz_dsttime;
+ timebuf->timezone = tz.tz_minuteswest_dep;
+ timebuf->dstflag = tz.tz_dsttime_dep;
return 0;
}
diff --git a/time/sys/time.h b/time/sys/time.h
index 5dbc7fc627f..a35ccb7a58b 100644
--- a/time/sys/time.h
+++ b/time/sys/time.h
@@ -51,8 +51,8 @@ __BEGIN_DECLS
This is obsolete and should never be used. */
struct timezone
{
- int tz_minuteswest; /* Minutes west of GMT. */
- int tz_dsttime; /* Nonzero if DST is ever in effect. */
+ int tz_minuteswest_dep; /* Minutes west of GMT. */
+ int tz_dsttime_dep; /* Nonzero if DST is ever in effect. */
};
typedef struct timezone *__restrict __timezone_ptr_t;
--
2.22.0