-- --
-- S p e c --
-- --
--- Copyright (C) 1999-2005, AdaCore --
--- --
--- This specification is derived from the Ada Reference Manual for use with --
--- GNAT. The copyright notice above, and the license provisions that follow --
--- apply solely to the contents of the part following the private keyword. --
+-- Copyright (C) 1999-2010, 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- --
--- ware Foundation; either version 2, or (at your option) any later ver- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
--- for more details. You should have received a copy of the GNU General --
--- Public License distributed with GNAT; see file COPYING. If not, write --
--- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
--- Boston, MA 02110-1301, USA. --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception, --
+-- version 3.1, as published by the Free Software Foundation. --
-- --
--- As a special exception, if other files instantiate generics from this --
--- unit, or you link this unit with other files to produce an executable, --
--- this unit does not by itself cause the resulting executable to be --
--- covered by the GNU General Public License. This exception does not --
--- however invalidate any other reasons why the executable file might be --
--- covered by the GNU Public License. --
+-- You should have received a copy of the GNU General Public License and --
+-- a copy of the GCC Runtime Library Exception along with this program; --
+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
+-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
(Date : Ada.Calendar.Time;
Picture : Picture_String) return String;
-- Return Date as a string with format Picture. Raise Picture_Error if
- -- picture string is wrong.
+ -- picture string is null or has an incorrect format.
- procedure Put_Time
- (Date : Ada.Calendar.Time;
- Picture : Picture_String);
- -- Put Date with format Picture. Raise Picture_Error if picture string is
- -- wrong
+ function Value (Date : String) return Ada.Calendar.Time;
+ -- Parse the string Date and return its equivalent as a Time value. The
+ -- following time format is supported:
+ --
+ -- hh:mm:ss - Date is the current date
+ --
+ -- The following formats are also supported. They all accept an optional
+ -- time with the format "hh:mm:ss". The time is separated from the date by
+ -- exactly one space character.
+ --
+ -- When the time is not specified, it is set to 00:00:00. The delimiter '*'
+ -- must be either '-' and '/' and both occurrences must use the same
+ -- character.
+ --
+ -- Trailing characters (in particular spaces) are not allowed
+ --
+ -- 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
+ -- yyyy*mmm*dd - month spelled out
+ -- yyyymmdd - Iso format, no separator
+ -- mmm dd, yyyy - month spelled out
+ -- dd mmm yyyy - month spelled out
+ --
+ -- 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);
+ -- Put Date with format Picture. Raise Picture_Error if bad picture string
private
ISO_Date : constant Picture_String := "%Y-%m-%d";