From 063ed58ba58dbc58df2d0e1176dc962f0ffd7c45 Mon Sep 17 00:00:00 2001 From: charlet Date: Tue, 7 Jul 2009 12:42:43 +0000 Subject: 2009-07-07 Robert Dewar * 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 --- gcc/ada/a-calend.adb | 32 +++++++++----------------------- 1 file changed, 9 insertions(+), 23 deletions(-) (limited to 'gcc/ada/a-calend.adb') 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; -- cgit v1.2.1