diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-04-06 09:15:21 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-04-06 09:15:21 +0000 |
commit | eaa006632546b894576a92e971294c7e9ac5231b (patch) | |
tree | 7a061f08c1577dcad5f77bb59e183a711e8af6e1 /gcc/ada/a-catizo.adb | |
parent | 232e4d04f0263022b1379a7886e28e7f082f7eb8 (diff) | |
download | gcc-eaa006632546b894576a92e971294c7e9ac5231b.tar.gz |
2007-04-06 Hristian Kirtchev <kirtchev@adacore.com>
Vincent Celier <celier@adacore.com>
* a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb:
New version of Ada.Calendar which supports the new upper bound of Ada
time (2399-12-31 86_399.999999999).
The following modifications have been made to the package:
- New representation of time as count of nanoseconds since the start of
Ada time (1901-1-1 0.0).
- Target independent Split and Time_Of routines which service both
Ada 95 and Ada 2005 code.
- Target independent interface to the Ada 2005 children of Calendar.
- Integrated leap seconds into Ada 95 and Ada 2005 mode.
- Handling of non-leap centenial years.
- Updated clock function.
- Updated arithmetic and comparison operators.
* a-caldel.adb (To_Duration): Add call to target independent routine in
Ada.Calendar to handle the conversion of time to duration.
* sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off
(UTC Offset).
If timezone is obviously incorrect (outside of -14 hours .. 14 hours),
set off to 0.
(__gnat_localtime_tzoff for Lynx and VxWorks): Even though these
targets do not have a natural time zone, GMT is used as a default.
(__gnat_get_task_options): New.
* a-direct.adb (Modification_Time): Add with and use clauses for
Ada.Calendar and Ada.
Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion
since it is no longer needed.
(Duration_To_Time): Removed.
(OS_Time_To_Long_Integer): Removed.
(Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar.
Formatting Time_Of routines which automatically handle time zones,
buffer periods and leap seconds.
* a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to
target independent routines in Ada.Calendar.
* a-calfor.ads, a-calfor.adb:
Code cleanup and addition of validity checks in various routines.
(Day_Of_Week, Split, Time_Of): Add call to target independent routine in
Ada.Calendar.
* a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target
independent routine in Ada.Calendar.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@123543 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/a-catizo.adb')
-rw-r--r-- | gcc/ada/a-catizo.adb | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/gcc/ada/a-catizo.adb b/gcc/ada/a-catizo.adb index 8243e8b9639..f6277397d73 100644 --- a/gcc/ada/a-catizo.adb +++ b/gcc/ada/a-catizo.adb @@ -33,35 +33,39 @@ package body Ada.Calendar.Time_Zones is + -------------------------- + -- Implementation Notes -- + -------------------------- + + -- All operations in this package are target and time representation + -- independent, thus only one source file is needed for multiple targets. + --------------------- -- UTC_Time_Offset -- --------------------- function UTC_Time_Offset (Date : Time := Clock) return Time_Offset is - Year : Year_Number; - Month : Month_Number; - Day : Day_Number; - Seconds : Day_Duration; - Offset : Long_Integer; + Offset_L : constant Long_Integer := + Time_Zones_Operations.UTC_Time_Offset (Date); + Offset : Time_Offset; begin - Split_With_Offset (Date, Year, Month, Day, Seconds, Offset); - - -- The system dependent code does not support time zones - - if Offset = Invalid_TZ_Offset then + if Offset_L = Invalid_Time_Zone_Offset then raise Unknown_Zone_Error; end if; - Offset := Offset / 60; + -- The offset returned by Time_Zones_Operations.UTC_Time_Offset is in + -- seconds, the returned value needs to be in minutes. + + Offset := Time_Offset (Offset_L / 60); + + -- Validity checks - if Offset < Long_Integer (Time_Offset'First) - or else Offset > Long_Integer (Time_Offset'Last) - then + if not Offset'Valid then raise Unknown_Zone_Error; end if; - return Time_Offset (Offset); + return Offset; end UTC_Time_Offset; end Ada.Calendar.Time_Zones; |