gcc/gcc/ada/a-catizo.adb

70 lines
3.3 KiB
Ada
Raw Normal View History

a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar... 2006-10-31 Hristian Kirtchev <kirtchev@adacore.com> Jose Ruiz <ruiz@adacore.com> * a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar: all subprogram raise Unimplemented. (Split_W_Offset): Temp function body, raising Unimplemented * a-calend.ads, a-calend-vms.ads: Add imported variable Invalid_TZ_Offset used to designate targets unable to support time zones. (Unimplemented): Temporary function raised by the body of new subprograms below. (Leap_Sec_Ops): New package in the private part of Ada.Calendar. This unit provides handling of leap seconds and is used by the new Ada 2005 packages Ada.Calendar.Arithmetic and Ada.Calendar.Formatting. (Split_W_Offset): Identical spec to that of Ada.Calendar.Split. This version returns an extra value which is the offset to UTC. * a-calend.adb (Split_W_Offset): Add call to localtime_tzoff. (Leap_Sec_Ops): New body for package in private part of Ada.Calendar. (Split_W_Offset): New function body. (Time_Of): When a date is close to UNIX epoch, compute the time for that date plus one day (that amount is later substracted after executing mktime) so there are no problems with time zone adjustments. * a-calend-mingw.adb: Remove Windows specific version no longer needed. * a-calari.ads, a-calari.adb, a-calfor.ads, a-calfor.adb, a-catizo.ads, a-catizo.adb: New files. * impunit.adb: Add new Ada 2005 entries * sysdep.c: Add external variable __gnat_invalid_tz_offset. Rename all occurences of "__gnat_localtime_r" to "__gnat_localtime_tzoff". (__gnat_localtime_tzoff for Windows): Add logic to retrieve the time zone data and calculate the GMT offset. (__gnat_localtime_tzoff for Darwin, Free BSD, Linux, Lynx and Tru64): Use the field "tm_gmtoff" to extract the GMT offset. (__gnat_localtime_tzoff for AIX, HPUX, SGI Irix and Sun Solaris): Use the external variable "timezone" to calculate the GMT offset. From-SVN: r118234
2006-10-31 18:44:55 +01:00
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . C A L E N D A R . T I M E _ Z O N E S --
-- --
-- B o d y --
-- --
-- Copyright (C) 2009, Free Software Foundation, Inc. --
a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar... 2006-10-31 Hristian Kirtchev <kirtchev@adacore.com> Jose Ruiz <ruiz@adacore.com> * a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar: all subprogram raise Unimplemented. (Split_W_Offset): Temp function body, raising Unimplemented * a-calend.ads, a-calend-vms.ads: Add imported variable Invalid_TZ_Offset used to designate targets unable to support time zones. (Unimplemented): Temporary function raised by the body of new subprograms below. (Leap_Sec_Ops): New package in the private part of Ada.Calendar. This unit provides handling of leap seconds and is used by the new Ada 2005 packages Ada.Calendar.Arithmetic and Ada.Calendar.Formatting. (Split_W_Offset): Identical spec to that of Ada.Calendar.Split. This version returns an extra value which is the offset to UTC. * a-calend.adb (Split_W_Offset): Add call to localtime_tzoff. (Leap_Sec_Ops): New body for package in private part of Ada.Calendar. (Split_W_Offset): New function body. (Time_Of): When a date is close to UNIX epoch, compute the time for that date plus one day (that amount is later substracted after executing mktime) so there are no problems with time zone adjustments. * a-calend-mingw.adb: Remove Windows specific version no longer needed. * a-calari.ads, a-calari.adb, a-calfor.ads, a-calfor.adb, a-catizo.ads, a-catizo.adb: New files. * impunit.adb: Add new Ada 2005 entries * sysdep.c: Add external variable __gnat_invalid_tz_offset. Rename all occurences of "__gnat_localtime_r" to "__gnat_localtime_tzoff". (__gnat_localtime_tzoff for Windows): Add logic to retrieve the time zone data and calculate the GMT offset. (__gnat_localtime_tzoff for Darwin, Free BSD, Linux, Lynx and Tru64): Use the field "tm_gmtoff" to extract the GMT offset. (__gnat_localtime_tzoff for AIX, HPUX, SGI Irix and Sun Solaris): Use the external variable "timezone" to calculate the GMT offset. From-SVN: r118234
2006-10-31 18:44:55 +01:00
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar... 2006-10-31 Hristian Kirtchev <kirtchev@adacore.com> Jose Ruiz <ruiz@adacore.com> * a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar: all subprogram raise Unimplemented. (Split_W_Offset): Temp function body, raising Unimplemented * a-calend.ads, a-calend-vms.ads: Add imported variable Invalid_TZ_Offset used to designate targets unable to support time zones. (Unimplemented): Temporary function raised by the body of new subprograms below. (Leap_Sec_Ops): New package in the private part of Ada.Calendar. This unit provides handling of leap seconds and is used by the new Ada 2005 packages Ada.Calendar.Arithmetic and Ada.Calendar.Formatting. (Split_W_Offset): Identical spec to that of Ada.Calendar.Split. This version returns an extra value which is the offset to UTC. * a-calend.adb (Split_W_Offset): Add call to localtime_tzoff. (Leap_Sec_Ops): New body for package in private part of Ada.Calendar. (Split_W_Offset): New function body. (Time_Of): When a date is close to UNIX epoch, compute the time for that date plus one day (that amount is later substracted after executing mktime) so there are no problems with time zone adjustments. * a-calend-mingw.adb: Remove Windows specific version no longer needed. * a-calari.ads, a-calari.adb, a-calfor.ads, a-calfor.adb, a-catizo.ads, a-catizo.adb: New files. * impunit.adb: Add new Ada 2005 entries * sysdep.c: Add external variable __gnat_invalid_tz_offset. Rename all occurences of "__gnat_localtime_r" to "__gnat_localtime_tzoff". (__gnat_localtime_tzoff for Windows): Add logic to retrieve the time zone data and calculate the GMT offset. (__gnat_localtime_tzoff for Darwin, Free BSD, Linux, Lynx and Tru64): Use the field "tm_gmtoff" to extract the GMT offset. (__gnat_localtime_tzoff for AIX, HPUX, SGI Irix and Sun Solaris): Use the external variable "timezone" to calculate the GMT offset. From-SVN: r118234
2006-10-31 18:44:55 +01:00
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar... 2006-10-31 Hristian Kirtchev <kirtchev@adacore.com> Jose Ruiz <ruiz@adacore.com> * a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar: all subprogram raise Unimplemented. (Split_W_Offset): Temp function body, raising Unimplemented * a-calend.ads, a-calend-vms.ads: Add imported variable Invalid_TZ_Offset used to designate targets unable to support time zones. (Unimplemented): Temporary function raised by the body of new subprograms below. (Leap_Sec_Ops): New package in the private part of Ada.Calendar. This unit provides handling of leap seconds and is used by the new Ada 2005 packages Ada.Calendar.Arithmetic and Ada.Calendar.Formatting. (Split_W_Offset): Identical spec to that of Ada.Calendar.Split. This version returns an extra value which is the offset to UTC. * a-calend.adb (Split_W_Offset): Add call to localtime_tzoff. (Leap_Sec_Ops): New body for package in private part of Ada.Calendar. (Split_W_Offset): New function body. (Time_Of): When a date is close to UNIX epoch, compute the time for that date plus one day (that amount is later substracted after executing mktime) so there are no problems with time zone adjustments. * a-calend-mingw.adb: Remove Windows specific version no longer needed. * a-calari.ads, a-calari.adb, a-calfor.ads, a-calfor.adb, a-catizo.ads, a-catizo.adb: New files. * impunit.adb: Add new Ada 2005 entries * sysdep.c: Add external variable __gnat_invalid_tz_offset. Rename all occurences of "__gnat_localtime_r" to "__gnat_localtime_tzoff". (__gnat_localtime_tzoff for Windows): Add logic to retrieve the time zone data and calculate the GMT offset. (__gnat_localtime_tzoff for Darwin, Free BSD, Linux, Lynx and Tru64): Use the field "tm_gmtoff" to extract the GMT offset. (__gnat_localtime_tzoff for AIX, HPUX, SGI Irix and Sun Solaris): Use the external variable "timezone" to calculate the GMT offset. From-SVN: r118234
2006-10-31 18:44:55 +01:00
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
package body Ada.Calendar.Time_Zones is
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 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. From-SVN: r123543
2007-04-06 11:15:21 +02:00
--------------------------
-- Implementation Notes --
--------------------------
-- All operations in this package are target and time representation
-- independent, thus only one source file is needed for multiple targets.
a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar... 2006-10-31 Hristian Kirtchev <kirtchev@adacore.com> Jose Ruiz <ruiz@adacore.com> * a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar: all subprogram raise Unimplemented. (Split_W_Offset): Temp function body, raising Unimplemented * a-calend.ads, a-calend-vms.ads: Add imported variable Invalid_TZ_Offset used to designate targets unable to support time zones. (Unimplemented): Temporary function raised by the body of new subprograms below. (Leap_Sec_Ops): New package in the private part of Ada.Calendar. This unit provides handling of leap seconds and is used by the new Ada 2005 packages Ada.Calendar.Arithmetic and Ada.Calendar.Formatting. (Split_W_Offset): Identical spec to that of Ada.Calendar.Split. This version returns an extra value which is the offset to UTC. * a-calend.adb (Split_W_Offset): Add call to localtime_tzoff. (Leap_Sec_Ops): New body for package in private part of Ada.Calendar. (Split_W_Offset): New function body. (Time_Of): When a date is close to UNIX epoch, compute the time for that date plus one day (that amount is later substracted after executing mktime) so there are no problems with time zone adjustments. * a-calend-mingw.adb: Remove Windows specific version no longer needed. * a-calari.ads, a-calari.adb, a-calfor.ads, a-calfor.adb, a-catizo.ads, a-catizo.adb: New files. * impunit.adb: Add new Ada 2005 entries * sysdep.c: Add external variable __gnat_invalid_tz_offset. Rename all occurences of "__gnat_localtime_r" to "__gnat_localtime_tzoff". (__gnat_localtime_tzoff for Windows): Add logic to retrieve the time zone data and calculate the GMT offset. (__gnat_localtime_tzoff for Darwin, Free BSD, Linux, Lynx and Tru64): Use the field "tm_gmtoff" to extract the GMT offset. (__gnat_localtime_tzoff for AIX, HPUX, SGI Irix and Sun Solaris): Use the external variable "timezone" to calculate the GMT offset. From-SVN: r118234
2006-10-31 18:44:55 +01:00
---------------------
-- UTC_Time_Offset --
---------------------
function UTC_Time_Offset (Date : Time := Clock) return Time_Offset is
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 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. From-SVN: r123543
2007-04-06 11:15:21 +02:00
Offset_L : constant Long_Integer :=
Time_Zones_Operations.UTC_Time_Offset (Date);
Offset : Time_Offset;
a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar... 2006-10-31 Hristian Kirtchev <kirtchev@adacore.com> Jose Ruiz <ruiz@adacore.com> * a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar: all subprogram raise Unimplemented. (Split_W_Offset): Temp function body, raising Unimplemented * a-calend.ads, a-calend-vms.ads: Add imported variable Invalid_TZ_Offset used to designate targets unable to support time zones. (Unimplemented): Temporary function raised by the body of new subprograms below. (Leap_Sec_Ops): New package in the private part of Ada.Calendar. This unit provides handling of leap seconds and is used by the new Ada 2005 packages Ada.Calendar.Arithmetic and Ada.Calendar.Formatting. (Split_W_Offset): Identical spec to that of Ada.Calendar.Split. This version returns an extra value which is the offset to UTC. * a-calend.adb (Split_W_Offset): Add call to localtime_tzoff. (Leap_Sec_Ops): New body for package in private part of Ada.Calendar. (Split_W_Offset): New function body. (Time_Of): When a date is close to UNIX epoch, compute the time for that date plus one day (that amount is later substracted after executing mktime) so there are no problems with time zone adjustments. * a-calend-mingw.adb: Remove Windows specific version no longer needed. * a-calari.ads, a-calari.adb, a-calfor.ads, a-calfor.adb, a-catizo.ads, a-catizo.adb: New files. * impunit.adb: Add new Ada 2005 entries * sysdep.c: Add external variable __gnat_invalid_tz_offset. Rename all occurences of "__gnat_localtime_r" to "__gnat_localtime_tzoff". (__gnat_localtime_tzoff for Windows): Add logic to retrieve the time zone data and calculate the GMT offset. (__gnat_localtime_tzoff for Darwin, Free BSD, Linux, Lynx and Tru64): Use the field "tm_gmtoff" to extract the GMT offset. (__gnat_localtime_tzoff for AIX, HPUX, SGI Irix and Sun Solaris): Use the external variable "timezone" to calculate the GMT offset. From-SVN: r118234
2006-10-31 18:44:55 +01:00
begin
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 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. From-SVN: r123543
2007-04-06 11:15:21 +02:00
if Offset_L = Invalid_Time_Zone_Offset then
a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar... 2006-10-31 Hristian Kirtchev <kirtchev@adacore.com> Jose Ruiz <ruiz@adacore.com> * a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar: all subprogram raise Unimplemented. (Split_W_Offset): Temp function body, raising Unimplemented * a-calend.ads, a-calend-vms.ads: Add imported variable Invalid_TZ_Offset used to designate targets unable to support time zones. (Unimplemented): Temporary function raised by the body of new subprograms below. (Leap_Sec_Ops): New package in the private part of Ada.Calendar. This unit provides handling of leap seconds and is used by the new Ada 2005 packages Ada.Calendar.Arithmetic and Ada.Calendar.Formatting. (Split_W_Offset): Identical spec to that of Ada.Calendar.Split. This version returns an extra value which is the offset to UTC. * a-calend.adb (Split_W_Offset): Add call to localtime_tzoff. (Leap_Sec_Ops): New body for package in private part of Ada.Calendar. (Split_W_Offset): New function body. (Time_Of): When a date is close to UNIX epoch, compute the time for that date plus one day (that amount is later substracted after executing mktime) so there are no problems with time zone adjustments. * a-calend-mingw.adb: Remove Windows specific version no longer needed. * a-calari.ads, a-calari.adb, a-calfor.ads, a-calfor.adb, a-catizo.ads, a-catizo.adb: New files. * impunit.adb: Add new Ada 2005 entries * sysdep.c: Add external variable __gnat_invalid_tz_offset. Rename all occurences of "__gnat_localtime_r" to "__gnat_localtime_tzoff". (__gnat_localtime_tzoff for Windows): Add logic to retrieve the time zone data and calculate the GMT offset. (__gnat_localtime_tzoff for Darwin, Free BSD, Linux, Lynx and Tru64): Use the field "tm_gmtoff" to extract the GMT offset. (__gnat_localtime_tzoff for AIX, HPUX, SGI Irix and Sun Solaris): Use the external variable "timezone" to calculate the GMT offset. From-SVN: r118234
2006-10-31 18:44:55 +01:00
raise Unknown_Zone_Error;
end if;
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 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. From-SVN: r123543
2007-04-06 11:15:21 +02:00
-- 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
a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar... 2006-10-31 Hristian Kirtchev <kirtchev@adacore.com> Jose Ruiz <ruiz@adacore.com> * a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar: all subprogram raise Unimplemented. (Split_W_Offset): Temp function body, raising Unimplemented * a-calend.ads, a-calend-vms.ads: Add imported variable Invalid_TZ_Offset used to designate targets unable to support time zones. (Unimplemented): Temporary function raised by the body of new subprograms below. (Leap_Sec_Ops): New package in the private part of Ada.Calendar. This unit provides handling of leap seconds and is used by the new Ada 2005 packages Ada.Calendar.Arithmetic and Ada.Calendar.Formatting. (Split_W_Offset): Identical spec to that of Ada.Calendar.Split. This version returns an extra value which is the offset to UTC. * a-calend.adb (Split_W_Offset): Add call to localtime_tzoff. (Leap_Sec_Ops): New body for package in private part of Ada.Calendar. (Split_W_Offset): New function body. (Time_Of): When a date is close to UNIX epoch, compute the time for that date plus one day (that amount is later substracted after executing mktime) so there are no problems with time zone adjustments. * a-calend-mingw.adb: Remove Windows specific version no longer needed. * a-calari.ads, a-calari.adb, a-calfor.ads, a-calfor.adb, a-catizo.ads, a-catizo.adb: New files. * impunit.adb: Add new Ada 2005 entries * sysdep.c: Add external variable __gnat_invalid_tz_offset. Rename all occurences of "__gnat_localtime_r" to "__gnat_localtime_tzoff". (__gnat_localtime_tzoff for Windows): Add logic to retrieve the time zone data and calculate the GMT offset. (__gnat_localtime_tzoff for Darwin, Free BSD, Linux, Lynx and Tru64): Use the field "tm_gmtoff" to extract the GMT offset. (__gnat_localtime_tzoff for AIX, HPUX, SGI Irix and Sun Solaris): Use the external variable "timezone" to calculate the GMT offset. From-SVN: r118234
2006-10-31 18:44:55 +01:00
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 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. From-SVN: r123543
2007-04-06 11:15:21 +02:00
if not Offset'Valid then
a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar... 2006-10-31 Hristian Kirtchev <kirtchev@adacore.com> Jose Ruiz <ruiz@adacore.com> * a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar: all subprogram raise Unimplemented. (Split_W_Offset): Temp function body, raising Unimplemented * a-calend.ads, a-calend-vms.ads: Add imported variable Invalid_TZ_Offset used to designate targets unable to support time zones. (Unimplemented): Temporary function raised by the body of new subprograms below. (Leap_Sec_Ops): New package in the private part of Ada.Calendar. This unit provides handling of leap seconds and is used by the new Ada 2005 packages Ada.Calendar.Arithmetic and Ada.Calendar.Formatting. (Split_W_Offset): Identical spec to that of Ada.Calendar.Split. This version returns an extra value which is the offset to UTC. * a-calend.adb (Split_W_Offset): Add call to localtime_tzoff. (Leap_Sec_Ops): New body for package in private part of Ada.Calendar. (Split_W_Offset): New function body. (Time_Of): When a date is close to UNIX epoch, compute the time for that date plus one day (that amount is later substracted after executing mktime) so there are no problems with time zone adjustments. * a-calend-mingw.adb: Remove Windows specific version no longer needed. * a-calari.ads, a-calari.adb, a-calfor.ads, a-calfor.adb, a-catizo.ads, a-catizo.adb: New files. * impunit.adb: Add new Ada 2005 entries * sysdep.c: Add external variable __gnat_invalid_tz_offset. Rename all occurences of "__gnat_localtime_r" to "__gnat_localtime_tzoff". (__gnat_localtime_tzoff for Windows): Add logic to retrieve the time zone data and calculate the GMT offset. (__gnat_localtime_tzoff for Darwin, Free BSD, Linux, Lynx and Tru64): Use the field "tm_gmtoff" to extract the GMT offset. (__gnat_localtime_tzoff for AIX, HPUX, SGI Irix and Sun Solaris): Use the external variable "timezone" to calculate the GMT offset. From-SVN: r118234
2006-10-31 18:44:55 +01:00
raise Unknown_Zone_Error;
end if;
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 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. From-SVN: r123543
2007-04-06 11:15:21 +02:00
return Offset;
a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar... 2006-10-31 Hristian Kirtchev <kirtchev@adacore.com> Jose Ruiz <ruiz@adacore.com> * a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar: all subprogram raise Unimplemented. (Split_W_Offset): Temp function body, raising Unimplemented * a-calend.ads, a-calend-vms.ads: Add imported variable Invalid_TZ_Offset used to designate targets unable to support time zones. (Unimplemented): Temporary function raised by the body of new subprograms below. (Leap_Sec_Ops): New package in the private part of Ada.Calendar. This unit provides handling of leap seconds and is used by the new Ada 2005 packages Ada.Calendar.Arithmetic and Ada.Calendar.Formatting. (Split_W_Offset): Identical spec to that of Ada.Calendar.Split. This version returns an extra value which is the offset to UTC. * a-calend.adb (Split_W_Offset): Add call to localtime_tzoff. (Leap_Sec_Ops): New body for package in private part of Ada.Calendar. (Split_W_Offset): New function body. (Time_Of): When a date is close to UNIX epoch, compute the time for that date plus one day (that amount is later substracted after executing mktime) so there are no problems with time zone adjustments. * a-calend-mingw.adb: Remove Windows specific version no longer needed. * a-calari.ads, a-calari.adb, a-calfor.ads, a-calfor.adb, a-catizo.ads, a-catizo.adb: New files. * impunit.adb: Add new Ada 2005 entries * sysdep.c: Add external variable __gnat_invalid_tz_offset. Rename all occurences of "__gnat_localtime_r" to "__gnat_localtime_tzoff". (__gnat_localtime_tzoff for Windows): Add logic to retrieve the time zone data and calculate the GMT offset. (__gnat_localtime_tzoff for Darwin, Free BSD, Linux, Lynx and Tru64): Use the field "tm_gmtoff" to extract the GMT offset. (__gnat_localtime_tzoff for AIX, HPUX, SGI Irix and Sun Solaris): Use the external variable "timezone" to calculate the GMT offset. From-SVN: r118234
2006-10-31 18:44:55 +01:00
end UTC_Time_Offset;
end Ada.Calendar.Time_Zones;