From 88eb6e62fcba2cb0c92194b4a3dbb29c4385ae75 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Mon, 17 Aug 2009 11:35:50 +0200 Subject: [multiple changes] 2009-08-17 Robert Dewar * prj-env.adb: Minor reformatting * sem_ch3.adb: Minor reformatting 2009-08-17 Hristian Kirtchev * sysdep.c (__gnat_localtime_tzoff): VxWorks case - Flip the sign of the time zone since VxWorks chose positive values to represent west time zones and negative for east zones. From-SVN: r150826 --- gcc/ada/sysdep.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'gcc/ada/sysdep.c') diff --git a/gcc/ada/sysdep.c b/gcc/ada/sysdep.c index ffda3ab..6019fd9 100644 --- a/gcc/ada/sysdep.c +++ b/gcc/ada/sysdep.c @@ -868,6 +868,8 @@ __gnat_localtime_tzoff (const time_t *timer, long *off) (*Unlock_Task) (); + /* Correct the offset if Daylight Saving Time is in effect */ + if (tp.tm_isdst > 0) *off = *off + 3600; } @@ -902,9 +904,16 @@ __gnat_localtime_tzoff (const time_t *timer, long *off) tz_end = index (tz_start, ':'); tz_end = '\0'; - /* The Ada layer expects an offset in seconds */ + /* The Ada layer expects an offset in seconds. Note that we must reverse + the sign of the result since west is positive and east is negative on + VxWorks targets. */ + + *off = -atol (tz_start) * 60; + + /* Correct the offset if Daylight Saving Time is in effect */ - *off = atol (tz_start) * 60; + if (tp.tm_isdst > 0) + *off = *off - 3600; } (*Unlock_Task) (); -- cgit v1.1