-- --
------------------------------------------------------------------------------
-with Ada.Calendar; use Ada.Calendar;
-with Ada.Calendar.Time_Zones;
with Ada.Characters.Handling;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Ada.Text_IO;
-- Image --
-----------
+ function Image
+ (Date : Ada.Calendar.Time;
+ Picture : Picture_String;
+ Time_Zone : Time_Zones.Time_Offset) return String
+ is
+ -- We subtract off the local time zone, and add in the requested
+ -- Time_Zone, and then pass it on to the version of Image that uses
+ -- the local time zone.
+
+ use Time_Zones;
+ Local_TZ : constant Time_Offset := Local_Time_Offset (Date);
+ Minute_Offset : constant Integer := Integer (Time_Zone - Local_TZ);
+ Second_Offset : constant Integer := Minute_Offset * 60;
+ begin
+ return Image (Date + Duration (Second_Offset), Picture);
+ end Image;
+
+ -----------
+ -- Image --
+ -----------
+
function Image
(Date : Ada.Calendar.Time;
Picture : Picture_String) return String
-- This package augments standard Ada.Text_IO with facilities for input
-- and output of time values in standardized format.
+with Ada.Calendar.Time_Zones; use Ada.Calendar;
+
package GNAT.Calendar.Time_IO is
Picture_Error : exception;
-- with format Picture. Raise Picture_Error if picture string is null or
-- has an incorrect format.
+ function Image
+ (Date : Ada.Calendar.Time;
+ Picture : Picture_String;
+ Time_Zone : Time_Zones.Time_Offset) return String;
+ -- Same as previous Image, except it uses the specified time zone instead
+ -- of the local time zone.
+
function Value (Date : String) return Ada.Calendar.Time;
-- Parse the string Date, interpreted as a time representation in the
-- current local time zone, and return the corresponding Time value. The