From 632d4a43d7ab74554898509d7a99edccf09819cc Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Fri, 31 Jan 2020 09:18:37 -0500 Subject: [PATCH] [Ada] AI12-0336 Meaning of Time_Offset 2020-06-05 Arnaud Charlet gcc/ada/ * libgnat/a-calfor.ads, libgnat/a-catizo.ads, libgnat/a-catizo.adb (Local_Time_Offset, Local_Image): New. (UTC_Time_Offset): Now a renaming of Local_Time_Offset. --- gcc/ada/libgnat/a-calfor.ads | 8 ++++++++ gcc/ada/libgnat/a-catizo.adb | 10 +++++----- gcc/ada/libgnat/a-catizo.ads | 8 ++++++-- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/gcc/ada/libgnat/a-calfor.ads b/gcc/ada/libgnat/a-calfor.ads index 2996b7b2af7..599e39526a8 100644 --- a/gcc/ada/libgnat/a-calfor.ads +++ b/gcc/ada/libgnat/a-calfor.ads @@ -206,6 +206,14 @@ package Ada.Calendar.Formatting is -- prefixed with a minus sign. If abs Elapsed_Time represents 100 hours or -- more, Time_Error is raised. + function Local_Image + (Date : Time; + Include_Time_Fraction : Boolean := False) return String + is (Image (Date, + Include_Time_Fraction, + Time_Zones.Local_Time_Offset (Date))); + -- Returns a string form of Date relative to the local time offset. + function Value (Elapsed_Time : String) return Duration; -- Returns a Duration value for the image given as Elapsed_Time. -- Constraint_Error is raised if the string is not formatted as described diff --git a/gcc/ada/libgnat/a-catizo.adb b/gcc/ada/libgnat/a-catizo.adb index 181e65a388a..f18344501e9 100644 --- a/gcc/ada/libgnat/a-catizo.adb +++ b/gcc/ada/libgnat/a-catizo.adb @@ -38,11 +38,11 @@ package body Ada.Calendar.Time_Zones is -- All operations in this package are target and time representation -- independent, thus only one source file is needed for multiple targets. - --------------------- - -- UTC_Time_Offset -- - --------------------- + ----------------------- + -- Local_Time_Offset -- + ----------------------- - function UTC_Time_Offset (Date : Time := Clock) return Time_Offset is + function Local_Time_Offset (Date : Time := Clock) return Time_Offset is Offset_L : constant Long_Integer := Time_Zones_Operations.UTC_Time_Offset (Date); Offset : Time_Offset; @@ -64,6 +64,6 @@ package body Ada.Calendar.Time_Zones is end if; return Offset; - end UTC_Time_Offset; + end Local_Time_Offset; end Ada.Calendar.Time_Zones; diff --git a/gcc/ada/libgnat/a-catizo.ads b/gcc/ada/libgnat/a-catizo.ads index 5f558691eef..59ac7ad5dc0 100644 --- a/gcc/ada/libgnat/a-catizo.ads +++ b/gcc/ada/libgnat/a-catizo.ads @@ -16,7 +16,9 @@ -- This package provides routines to determine the offset of dates to GMT. -- It is defined in the Ada 2005 RM (9.6.1). -package Ada.Calendar.Time_Zones is +package Ada.Calendar.Time_Zones +-- with Nonblocking +is -- Time zone manipulation @@ -24,7 +26,9 @@ package Ada.Calendar.Time_Zones is Unknown_Zone_Error : exception; - function UTC_Time_Offset (Date : Time := Clock) return Time_Offset; + function Local_Time_Offset (Date : Time := Clock) return Time_Offset; + function UTC_Time_Offset (Date : Time := Clock) return Time_Offset + renames Local_Time_Offset; -- Returns (in minutes), the difference between the implementation-defined -- time zone of Calendar, and UTC time, at the time Date. If the time zone -- of the Calendar implementation is unknown, raises Unknown_Zone_Error. -- 2.30.2