aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/a-calend.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2012-05-15 11:26:48 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2012-05-15 11:26:48 +0200
commitdb664118be5bc2ea3e04784d45da659b13af1ef8 (patch)
treef379d457c02670132f951efa9f8c06c306d1a80b /gcc/ada/a-calend.adb
parenta02f0c5dfa9246a57970aeefe5c7196a17bf7b1c (diff)
downloadgcc-db664118be5bc2ea3e04784d45da659b13af1ef8.zip
gcc-db664118be5bc2ea3e04784d45da659b13af1ef8.tar.gz
gcc-db664118be5bc2ea3e04784d45da659b13af1ef8.tar.bz2
[multiple changes]
2012-05-15 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.adb (Day_Of_Week): The routine once again treats all dates as historic. (Formatting_Operations.Split): All calls to UTC_Time_Offset are now controlled through formal parameter Is_Historic. (Formatting_Operations.Time_Of): All calls to UTC_Time_Offset are now handled through formal parameter Is_Historic. (Split): Update the call to Formatting_Operations.Split. (Time_Of): Update the call to Formatting_Operations.Time_Of. (To_Ada_Time): Update the call to Formatting_Operations.Time_Of. (To_Strict_Tm): Update the call to Formatting_Operations.Split. * a-calend.ads (Split): Add new formal Is_Historic along with comment on usage. This routine is now exported for the purposes of GNAT.Calendar.Locale. (Time_Of): Remove defaults. Add new formal Is_Historic along with comment on usage. This routine is now exported for the purposes of GNAT.Calendar.Locale. * a-calend-vms.adb (Split): Update the call to Formatting_Operations.Split. (Time_Of): Update the call to Formatting_Operations.Time_Of. * a-calend-vms.ads (Split): Add new formal Is_Historic along with comment on usage. (Time_Of): Remove defaults. Add new formal Is_Historic along with comment on usage. * a-calfor.adb (Split): Update the call to Formatting_Operations.Split. (Time_Of): Update the call to Formatting_Operations.Time_Of. * impunit.adb: Include g-calloc to the list of non-RM defined units. 2012-05-15 Vincent Celier <celier@adacore.com> * prj-nmsc.adb (Add_Source): Always add the source if it is excluded, to avoid incorrect duplicate checks. 2012-05-15 Yannick Moy <moy@adacore.com> * sem_aux.ads: Correct typo. * sem_eval.adb (Compile_Time_Known_Value): Return False in Alfa mode for a deferred constant when outside of the scope of its full view. 2012-05-15 Emmanuel Briot <briot@adacore.com> * g-comlin.adb, g-comlin.ads (Define_Switch): Allow specifying the name of the argument, for the automatic help message. (Getopt): do not systematically initialize switches with string values to the empty string, when the user has already specified a default. From-SVN: r187504
Diffstat (limited to 'gcc/ada/a-calend.adb')
-rw-r--r--gcc/ada/a-calend.adb98
1 files changed, 55 insertions, 43 deletions
diff --git a/gcc/ada/a-calend.adb b/gcc/ada/a-calend.adb
index cecbc52..3d70cf4 100644
--- a/gcc/ada/a-calend.adb
+++ b/gcc/ada/a-calend.adb
@@ -579,18 +579,19 @@ package body Ada.Calendar is
-- ensure that Split picks up the local time zone.
Formatting_Operations.Split
- (Date => Date,
- Year => Year,
- Month => Month,
- Day => Day,
- Day_Secs => Seconds,
- Hour => H,
- Minute => M,
- Second => Se,
- Sub_Sec => Ss,
- Leap_Sec => Le,
- Use_TZ => False,
- Time_Zone => 0);
+ (Date => Date,
+ Year => Year,
+ Month => Month,
+ Day => Day,
+ Day_Secs => Seconds,
+ Hour => H,
+ Minute => M,
+ Second => Se,
+ Sub_Sec => Ss,
+ Leap_Sec => Le,
+ Use_TZ => False,
+ Is_Historic => True,
+ Time_Zone => 0);
-- Validity checks
@@ -649,6 +650,7 @@ package body Ada.Calendar is
Leap_Sec => False,
Use_Day_Secs => True,
Use_TZ => False,
+ Is_Historic => True,
Time_Zone => 0);
end Time_Of;
@@ -977,6 +979,7 @@ package body Ada.Calendar is
Leap_Sec => Leap,
Use_Day_Secs => False, -- Time is given in h:m:s
Use_TZ => True, -- Force usage of explicit time zone
+ Is_Historic => True,
Time_Zone => 0)); -- Place the value in UTC
-- Step 4: Daylight Savings Time
@@ -1055,8 +1058,19 @@ package body Ada.Calendar is
-- Step 1: Split the input time
Formatting_Operations.Split
- (T, Year, Month, tm_day, Day_Secs,
- tm_hour, tm_min, Second, Sub_Sec, Leap_Sec, True, 0);
+ (Date => T,
+ Year => Year,
+ Month => Month,
+ Day => tm_day,
+ Day_Secs => Day_Secs,
+ Hour => tm_hour,
+ Minute => tm_min,
+ Second => Second,
+ Sub_Sec => Sub_Sec,
+ Leap_Sec => Leap_Sec,
+ Use_TZ => True,
+ Is_Historic => False,
+ Time_Zone => 0);
-- Step 2: Correct the year and month
@@ -1154,12 +1168,8 @@ package body Ada.Calendar is
-----------------
function Day_Of_Week (Date : Time) return Integer is
- Date_N : constant Time_Rep := Time_Rep (Date);
-
- Time_Zone : constant Long_Integer := UTC_Time_Offset (Date, False);
- -- Keep the internal usage of UTC_Time_Offset consistent with Time_Of
- -- and Split.
-
+ Date_N : constant Time_Rep := Time_Rep (Date);
+ Time_Zone : constant Long_Integer := UTC_Time_Offset (Date, True);
Ada_Low_N : Time_Rep;
Day_Count : Long_Integer;
Day_Dur : Time_Dur;
@@ -1199,18 +1209,19 @@ package body Ada.Calendar is
-----------
procedure Split
- (Date : Time;
- Year : out Year_Number;
- Month : out Month_Number;
- Day : out Day_Number;
- Day_Secs : out Day_Duration;
- Hour : out Integer;
- Minute : out Integer;
- Second : out Integer;
- Sub_Sec : out Duration;
- Leap_Sec : out Boolean;
- Use_TZ : Boolean;
- Time_Zone : Long_Integer)
+ (Date : Time;
+ Year : out Year_Number;
+ Month : out Month_Number;
+ Day : out Day_Number;
+ Day_Secs : out Day_Duration;
+ Hour : out Integer;
+ Minute : out Integer;
+ Second : out Integer;
+ Sub_Sec : out Duration;
+ Leap_Sec : out Boolean;
+ Use_TZ : Boolean;
+ Is_Historic : Boolean;
+ Time_Zone : Long_Integer)
is
-- The following constants represent the number of nanoseconds
-- elapsed since the start of Ada time to and including the non
@@ -1272,7 +1283,7 @@ package body Ada.Calendar is
else
declare
Off : constant Long_Integer :=
- UTC_Time_Offset (Time (Date_N), False);
+ UTC_Time_Offset (Time (Date_N), Is_Historic);
begin
Date_N := Date_N + Time_Rep (Off) * Nano;
@@ -1388,10 +1399,11 @@ package body Ada.Calendar is
Minute : Integer;
Second : Integer;
Sub_Sec : Duration;
- Leap_Sec : Boolean := False;
- Use_Day_Secs : Boolean := False;
- Use_TZ : Boolean := False;
- Time_Zone : Long_Integer := 0) return Time
+ Leap_Sec : Boolean;
+ Use_Day_Secs : Boolean;
+ Use_TZ : Boolean;
+ Is_Historic : Boolean;
+ Time_Zone : Long_Integer) return Time
is
Count : Integer;
Elapsed_Leaps : Natural;
@@ -1493,12 +1505,12 @@ package body Ada.Calendar is
else
declare
- Current_Off : constant Long_Integer :=
- UTC_Time_Offset (Time (Res_N), False);
- Current_Res_N : constant Time_Rep :=
- Res_N - Time_Rep (Current_Off) * Nano;
- Off : constant Long_Integer :=
- UTC_Time_Offset (Time (Current_Res_N), False);
+ Cur_Off : constant Long_Integer :=
+ UTC_Time_Offset (Time (Res_N), Is_Historic);
+ Cur_Res_N : constant Time_Rep :=
+ Res_N - Time_Rep (Cur_Off) * Nano;
+ Off : constant Long_Integer :=
+ UTC_Time_Offset (Time (Cur_Res_N), Is_Historic);
begin
Res_N := Res_N - Time_Rep (Off) * Nano;