summaryrefslogtreecommitdiff
path: root/gcc/ada/a-calend.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2009-07-07 12:42:43 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2009-07-07 12:42:43 +0000
commit063ed58ba58dbc58df2d0e1176dc962f0ffd7c45 (patch)
treeb7d0419a6b1561d3e0b6744e89abd1f3e5bb63bd /gcc/ada/a-calend.adb
parent6ecef78852742a5294ce9e5ece9d0cd92af18db9 (diff)
downloadgcc-063ed58ba58dbc58df2d0e1176dc962f0ffd7c45.tar.gz
2009-07-07 Robert Dewar <dewar@adacore.com>
* a-calend.adb: Minor code reorganization (use conditional expressions) * s-stusta.ads, s-interr-hwint.adb, g-expect-vms.adb, s-secsta.ads, prj-nmsc.adb, a-teioed.adb, output.ads, prj-attr.ads, a-textio.adb, s-taskin.ads, scans.ads, s-osinte-vms.adb, s-taprop-solaris.adb, s-tpopsp-posix-foreign.adb, s-trafor-default.adb, gnat1drv.adb, s-stchop-vxworks.adb, s-tpopsp-posix.adb, prj-env.adb, prj-env.ads, g-comlin.adb, exp_ch11.adb: Minor reformatting. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149320 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/a-calend.adb')
-rw-r--r--gcc/ada/a-calend.adb32
1 files changed, 9 insertions, 23 deletions
diff --git a/gcc/ada/a-calend.adb b/gcc/ada/a-calend.adb
index 4c340eec0d1..04ea98b1884 100644
--- a/gcc/ada/a-calend.adb
+++ b/gcc/ada/a-calend.adb
@@ -940,11 +940,7 @@ package body Ada.Calendar is
-- Step 3: Handle leap second occurrences
- if Leap_Sec then
- tm_sec := 60;
- else
- tm_sec := Second;
- end if;
+ tm_sec := (if Leap_Sec then 60 else Second);
end To_Struct_Tm;
------------------
@@ -1014,11 +1010,8 @@ package body Ada.Calendar is
-- the input. Guard against very large delay values such as the end
-- of time since the computation will overflow.
- if Res_N > Safe_Ada_High then
- Res_N := Safe_Ada_High;
- else
- Res_N := Res_N + Epoch_Offset;
- end if;
+ Res_N := (if Res_N > Safe_Ada_High then Safe_Ada_High
+ else Res_N + Epoch_Offset);
return Time_Rep_To_Duration (Res_N);
end To_Duration;
@@ -1495,7 +1488,7 @@ package body Ada.Calendar is
---------------------
function UTC_Time_Offset (Date : Time) return Long_Integer is
- Adj_Cent : Integer := 0;
+ Adj_Cent : Integer;
Date_N : Time_Rep;
Offset : aliased long;
Secs_T : aliased time_t;
@@ -1507,18 +1500,11 @@ package body Ada.Calendar is
-- saving and so on. Non-leap centennial years violate this rule by
-- one day and as a consequence, special adjustment is needed.
- if Date_N > T_2100_2_28 then
- if Date_N > T_2200_2_28 then
- if Date_N > T_2300_2_28 then
- Adj_Cent := 3;
- else
- Adj_Cent := 2;
- end if;
-
- else
- Adj_Cent := 1;
- end if;
- end if;
+ Adj_Cent :=
+ (if Date_N <= T_2100_2_28 then 0
+ elsif Date_N <= T_2200_2_28 then 1
+ elsif Date_N <= T_2300_2_28 then 2
+ else 3);
if Adj_Cent > 0 then
Date_N := Date_N - Time_Rep (Adj_Cent) * Nanos_In_Day;