summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2008-08-20 16:12:38 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2008-08-20 16:12:38 +0000
commit1ed6b32e64ee2e4d3beee36afe9dca059d2fd8bb (patch)
tree8a4e04eeef44c992e94019eb9b126eb5761b8244
parentb5c96e71217948d4d86d803758d36c962c390373 (diff)
downloadgcc-1ed6b32e64ee2e4d3beee36afe9dca059d2fd8bb.tar.gz
2008-08-20 Emmanuel Briot <briot@adacore.com>
* g-catiio.ads, g-catiio.adb: (Value): Avoid an unnecessary system call to Clock in most cases. This call is only needed when only the time is provided in the string, and ignored in all other cases. This is more efficient. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@139333 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ada/g-catiio.adb27
-rw-r--r--gcc/ada/g-catiio.ads11
2 files changed, 18 insertions, 20 deletions
diff --git a/gcc/ada/g-catiio.adb b/gcc/ada/g-catiio.adb
index f7b318edbe3..0d0b9b849fc 100644
--- a/gcc/ada/g-catiio.adb
+++ b/gcc/ada/g-catiio.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1999-2007, AdaCore --
+-- Copyright (C) 1999-2008, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -560,13 +560,15 @@ package body GNAT.Calendar.Time_IO is
D : String (1 .. 21);
D_Length : constant Natural := Date'Length;
- Year : Year_Number;
- Month : Month_Number;
- Day : Day_Number;
- Hour : Hour_Number;
- Minute : Minute_Number;
- Second : Second_Number;
+ Year : Year_Number;
+ Month : Month_Number;
+ Day : Day_Number;
+ Hour : Hour_Number;
+ Minute : Minute_Number;
+ Second : Second_Number;
+
Sub_Second : Second_Duration;
+ -- We ignore subseconds in this routine, so this is a throw away value
procedure Extract_Date
(Year : out Year_Number;
@@ -770,9 +772,6 @@ package body GNAT.Calendar.Time_IO is
-- Start of processing for Value
begin
- Split (Clock, Year, Month, Day, Hour, Minute, Second, Sub_Second);
- Sub_Second := 0.0;
-
-- Length checks
if D_Length /= 8
@@ -792,12 +791,12 @@ package body GNAT.Calendar.Time_IO is
D (1 .. D_Length) := Date;
- if D_Length /= 8
- or else D (3) /= ':'
- then
+ if D_Length /= 8 or else D (3) /= ':' then
Extract_Date (Year, Month, Day, Time_Start);
Extract_Time (Time_Start, Hour, Minute, Second, Check_Space => True);
+
else
+ Split (Clock, Year, Month, Day, Hour, Minute, Second, Sub_Second);
Extract_Time (1, Hour, Minute, Second, Check_Space => False);
end if;
@@ -813,7 +812,7 @@ package body GNAT.Calendar.Time_IO is
raise Constraint_Error;
end if;
- return Time_Of (Year, Month, Day, Hour, Minute, Second, Sub_Second);
+ return Time_Of (Year, Month, Day, Hour, Minute, Second);
end Value;
--------------
diff --git a/gcc/ada/g-catiio.ads b/gcc/ada/g-catiio.ads
index 34a38878c9f..1f73c2198ec 100644
--- a/gcc/ada/g-catiio.ads
+++ b/gcc/ada/g-catiio.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1999-2007, AdaCore --
+-- Copyright (C) 1999-2008, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -132,7 +132,7 @@ package GNAT.Calendar.Time_IO is
--
-- Trailing characters (in particular spaces) are not allowed
--
- -- yyyy*mm*dd
+ -- yyyy*mm*dd - ISO format
-- yy*mm*dd - Year is assumed to be 20yy
-- mm*dd*yyyy - (US date format)
-- dd*mmm*yyyy - month spelled out
@@ -141,12 +141,11 @@ package GNAT.Calendar.Time_IO is
-- mmm dd, yyyy - month spelled out
-- dd mmm yyyy - month spelled out
--
- -- Constraint_Error is raised if the input string is malformatted or
+ -- Constraint_Error is raised if the input string is malformed (does not
+ -- conform to one of the above dates, or has an invalid time string), or
-- the resulting time is not valid.
- procedure Put_Time
- (Date : Ada.Calendar.Time;
- Picture : Picture_String);
+ procedure Put_Time (Date : Ada.Calendar.Time; Picture : Picture_String);
-- Put Date with format Picture. Raise Picture_Error if bad picture string
private