aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sysdep.c
diff options
context:
space:
mode:
authorDoug Rupp <rupp@adacore.com>2021-06-22 08:31:50 -0700
committerPierre-Marie de Rodat <derodat@adacore.com>2021-09-20 12:31:36 +0000
commitc5049dfec7e13e458fbda1e9f01ffb0658484f70 (patch)
treef744d50fd45b84b47c4cd57bfc03d2db03a31eaa /gcc/ada/sysdep.c
parenta06c060b1555a74d27d2573a25b769dd024023c0 (diff)
downloadgcc-c5049dfec7e13e458fbda1e9f01ffb0658484f70.zip
gcc-c5049dfec7e13e458fbda1e9f01ffb0658484f70.tar.gz
gcc-c5049dfec7e13e458fbda1e9f01ffb0658484f70.tar.bz2
[Ada] Use OS_Time for interface to TZ functions.
gcc/ada/ * libgnat/a-calend.adb: Remove time_t, replace with OS_Time. * libgnat/s-os_lib.ads: Fix comments regarding time_t conversion functions to reflect the use of To_Ada in in Ada.Calendar package body. * sysdep.c (__gnat_localtime_tzoff): Use OS_Time instead of time_t.
Diffstat (limited to 'gcc/ada/sysdep.c')
-rw-r--r--gcc/ada/sysdep.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/gcc/ada/sysdep.c b/gcc/ada/sysdep.c
index aa38c5c..ee951e3 100644
--- a/gcc/ada/sysdep.c
+++ b/gcc/ada/sysdep.c
@@ -643,11 +643,11 @@ long __gnat_invalid_tzoff = 259273;
/* Reentrant localtime for Windows. */
extern void
-__gnat_localtime_tzoff (const time_t *, const int *, long *);
+__gnat_localtime_tzoff (const OS_Time *, const int *, long *);
static const unsigned long long w32_epoch_offset = 11644473600ULL;
void
-__gnat_localtime_tzoff (const time_t *timer, const int *is_historic, long *off)
+__gnat_localtime_tzoff (const OS_Time *timer, const int *is_historic, long *off)
{
TIME_ZONE_INFORMATION tzi;
@@ -737,10 +737,10 @@ __gnat_localtime_tzoff (const time_t *timer, const int *is_historic, long *off)
the Lynx convention when building against the legacy API. */
extern void
-__gnat_localtime_tzoff (const time_t *, const int *, long *);
+__gnat_localtime_tzoff (const OS_Time *, const int *, long *);
void
-__gnat_localtime_tzoff (const time_t *timer, const int *is_historic, long *off)
+__gnat_localtime_tzoff (const OS_Time *timer, const int *is_historic, long *off)
{
*off = 0;
}
@@ -756,21 +756,22 @@ extern void (*Lock_Task) (void);
extern void (*Unlock_Task) (void);
extern void
-__gnat_localtime_tzoff (const time_t *, const int *, long *);
+__gnat_localtime_tzoff (const OS_Time *, const int *, long *);
void
-__gnat_localtime_tzoff (const time_t *timer ATTRIBUTE_UNUSED,
+__gnat_localtime_tzoff (const OS_Time *timer ATTRIBUTE_UNUSED,
const int *is_historic ATTRIBUTE_UNUSED,
long *off ATTRIBUTE_UNUSED)
{
struct tm tp ATTRIBUTE_UNUSED;
+ const time_t time = (time_t) *timer;
/* AIX, HPUX, Sun Solaris */
#if defined (_AIX) || defined (__hpux__) || defined (__sun__)
{
(*Lock_Task) ();
- localtime_r (timer, &tp);
+ localtime_r (&time, &tp);
*off = (long) -timezone;
(*Unlock_Task) ();
@@ -787,7 +788,7 @@ __gnat_localtime_tzoff (const time_t *timer ATTRIBUTE_UNUSED,
{
(*Lock_Task) ();
- localtime_r (timer, &tp);
+ localtime_r (&time, &tp);
/* Try to read the environment variable TIMEZONE. The variable may not have
been initialize, in that case return an offset of zero (0) for UTC. */
@@ -833,7 +834,7 @@ __gnat_localtime_tzoff (const time_t *timer ATTRIBUTE_UNUSED,
|| defined (__GLIBC__) || defined (__DragonFly__) || defined (__OpenBSD__) \
|| defined (__DJGPP__) || defined (__QNX__)
{
- localtime_r (timer, &tp);
+ localtime_r (&time, &tp);
*off = tp.tm_gmtoff;
}