PR c++/3637
[official-gcc.git] / gcc / ada / g-catiio.ads
blob59f0520becc63a4e8222e957179a5ed9e55a6542
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT RUN-TIME COMPONENTS --
4 -- --
5 -- G N A T . C A L E N D A R . T I M E _ I O --
6 -- --
7 -- S p e c --
8 -- --
9 -- $Revision: 1.5 $
10 -- --
11 -- Copyright (C) 1999-2001 Ada Core Technologies, Inc. --
12 -- --
13 -- This specification is derived from the Ada Reference Manual for use with --
14 -- GNAT. The copyright notice above, and the license provisions that follow --
15 -- apply solely to the contents of the part following the private keyword. --
16 -- --
17 -- GNAT is free software; you can redistribute it and/or modify it under --
18 -- terms of the GNU General Public License as published by the Free Soft- --
19 -- ware Foundation; either version 2, or (at your option) any later ver- --
20 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
21 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
22 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
23 -- for more details. You should have received a copy of the GNU General --
24 -- Public License distributed with GNAT; see file COPYING. If not, write --
25 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
26 -- MA 02111-1307, USA. --
27 -- --
28 -- As a special exception, if other files instantiate generics from this --
29 -- unit, or you link this unit with other files to produce an executable, --
30 -- this unit does not by itself cause the resulting executable to be --
31 -- covered by the GNU General Public License. This exception does not --
32 -- however invalidate any other reasons why the executable file might be --
33 -- covered by the GNU Public License. --
34 -- --
35 -- GNAT was originally developed by the GNAT team at New York University. --
36 -- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
37 -- --
38 ------------------------------------------------------------------------------
40 -- This package augments standard Ada.Text_IO with facilities for input
41 -- and output of time values in standardized format.
43 package GNAT.Calendar.Time_IO is
45 Picture_Error : exception;
47 type Picture_String is new String;
49 -- This is a string to describe date and time output format. The string is
50 -- a set of standard character and special tag that are replaced by the
51 -- corresponding values. It follows the GNU Date specification. Here are
52 -- the recognized directives :
54 -- % a literal %
55 -- n a newline
56 -- t a horizontal tab
58 -- Time fields:
60 -- %H hour (00..23)
61 -- %I hour (01..12)
62 -- %k hour ( 0..23)
63 -- %l hour ( 1..12)
64 -- %M minute (00..59)
65 -- %p locale's AM or PM
66 -- %r time, 12-hour (hh:mm:ss [AP]M)
67 -- %s seconds since 1970-01-01 00:00:00 UTC
68 -- (a nonstandard extension)
69 -- %S second (00..59)
70 -- %T time, 24-hour (hh:mm:ss)
72 -- Date fields:
74 -- %a locale's abbreviated weekday name (Sun..Sat)
75 -- %A locale's full weekday name, variable length
76 -- (Sunday..Saturday)
77 -- %b locale's abbreviated month name (Jan..Dec)
78 -- %B locale's full month name, variable length
79 -- (January..December)
80 -- %c locale's date and time (Sat Nov 04 12:02:33 EST 1989)
81 -- %d day of month (01..31)
82 -- %D date (mm/dd/yy)
83 -- %h same as %b
84 -- %j day of year (001..366)
85 -- %m month (01..12)
86 -- %U week number of year with Sunday as first day of week
87 -- (00..53)
88 -- %w day of week (0..6) with 0 corresponding to Sunday
89 -- %W week number of year with Monday as first day of week
90 -- (00..53)
91 -- %x locale's date representation (mm/dd/yy)
92 -- %y last two digits of year (00..99)
93 -- %Y year (1970...)
95 -- By default, date pads numeric fields with zeroes. GNU date
96 -- recognizes the following nonstandard numeric modifiers:
98 -- - (hyphen) do not pad the field
99 -- _ (underscore) pad the field with spaces
101 ISO_Date : constant Picture_String;
102 -- This format follow the ISO 8601 standard. The format is "YYYY-MM-DD",
103 -- four digits year, month and day number separated by minus.
105 US_Date : constant Picture_String;
106 -- This format is the common US date format: "MM/DD/YY",
107 -- month and day number, two digits year separated by slashes.
109 European_Date : constant Picture_String;
110 -- This format is the common European date format: "DD/MM/YY",
111 -- day and month number, two digits year separated by slashes.
113 function Image
114 (Date : Ada.Calendar.Time;
115 Picture : Picture_String)
116 return String;
117 -- Return Date as a string with format Picture.
118 -- raise Picture_Error if picture string is wrong
120 procedure Put_Time
121 (Date : Ada.Calendar.Time;
122 Picture : Picture_String);
123 -- Put Date with format Picture.
124 -- raise Picture_Error if picture string is wrong
126 private
127 ISO_Date : constant Picture_String := "%Y-%m-%d";
128 US_Date : constant Picture_String := "%m/%d/%y";
129 European_Date : constant Picture_String := "%d/%m/%y";
131 end GNAT.Calendar.Time_IO;