OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [ada/] [g-catiio.ads] - Blame information for rev 461

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 281 jeremybenn
------------------------------------------------------------------------------
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
--                     Copyright (C) 1999-2008, AdaCore                     --
10
--                                                                          --
11
-- GNAT is free software;  you can  redistribute it  and/or modify it under --
12
-- terms of the  GNU General Public License as published  by the Free Soft- --
13
-- ware  Foundation;  either version 2,  or (at your option) any later ver- --
14
-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
15
-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
16
-- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
17
-- for  more details.  You should have  received  a copy of the GNU General --
18
-- Public License  distributed with GNAT;  see file COPYING.  If not, write --
19
-- to  the  Free Software Foundation,  51  Franklin  Street,  Fifth  Floor, --
20
-- Boston, MA 02110-1301, USA.                                              --
21
--                                                                          --
22
-- As a special exception,  if other files  instantiate  generics from this --
23
-- unit, or you link  this unit with other files  to produce an executable, --
24
-- this  unit  does not  by itself cause  the resulting  executable  to  be --
25
-- covered  by the  GNU  General  Public  License.  This exception does not --
26
-- however invalidate  any other reasons why  the executable file  might be --
27
-- covered by the  GNU Public License.                                      --
28
--                                                                          --
29
-- GNAT was originally developed  by the GNAT team at  New York University. --
30
-- Extensive contributions were provided by Ada Core Technologies Inc.      --
31
--                                                                          --
32
------------------------------------------------------------------------------
33
 
34
--  This package augments standard Ada.Text_IO with facilities for input
35
--  and output of time values in standardized format.
36
 
37
package GNAT.Calendar.Time_IO is
38
 
39
   Picture_Error : exception;
40
   --  Exception raised for incorrect picture
41
 
42
   type Picture_String is new String;
43
   --  This is a string to describe date and time output format. The string is
44
   --  a set of standard character and special tag that are replaced by the
45
   --  corresponding values. It follows the GNU Date specification. Here are
46
   --  the recognized directives :
47
   --
48
   --          %    a literal %
49
   --          n    a newline
50
   --          t    a horizontal tab
51
   --
52
   --          Time fields:
53
   --
54
   --          %H   hour (00..23)
55
   --          %I   hour (01..12)
56
   --          %k   hour ( 0..23)
57
   --          %l   hour ( 1..12)
58
   --          %M   minute (00..59)
59
   --          %p   locale's AM or PM
60
   --          %r   time, 12-hour (hh:mm:ss [AP]M)
61
   --          %s   seconds  since 1970-01-01  00:00:00 UTC
62
   --                (a nonstandard extension)
63
   --          %S   second (00..59)
64
   --          %T   time, 24-hour (hh:mm:ss)
65
   --
66
   --          Date fields:
67
   --
68
   --          %a   locale's abbreviated weekday name (Sun..Sat)
69
   --          %A   locale's    full   weekday   name,    variable   length
70
   --                  (Sunday..Saturday)
71
   --          %b   locale's abbreviated month name (Jan..Dec)
72
   --          %B   locale's    full    month    name,   variable    length
73
   --                  (January..December)
74
   --          %c   locale's date and time (Sat Nov 04 12:02:33 EST 1989)
75
   --          %d   day of month (01..31)
76
   --          %D   date (mm/dd/yy)
77
   --          %h   same as %b
78
   --          %j   day of year (001..366)
79
   --          %m   month (01..12)
80
   --          %U   week number  of year with  Sunday as first day  of week
81
   --                  (00..53)
82
   --          %w   day of week (0..6) with 0 corresponding to Sunday
83
   --          %W   week number  of year with  Monday as first day  of week
84
   --                  (00..53)
85
   --          %x   locale's date representation (mm/dd/yy)
86
   --          %y   last two digits of year (00..99)
87
   --          %Y   year (1970...)
88
   --
89
   --          By default,  date pads numeric fields with zeroes.  GNU date
90
   --          recognizes the following nonstandard numeric modifiers:
91
   --
92
   --          -    (hyphen) do not pad the field
93
   --          _    (underscore) pad the field with spaces
94
   --
95
   --  Here are some GNAT extensions to the GNU Date specification:
96
   --
97
   --          %i   milliseconds (3 digits)
98
   --          %e   microseconds (6 digits)
99
   --          %o   nanoseconds  (9 digits)
100
 
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.
104
 
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.
108
 
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.
112
 
113
   function Image
114
     (Date    : Ada.Calendar.Time;
115
      Picture : Picture_String) return String;
116
   --  Return Date as a string with format Picture. Raise Picture_Error if
117
   --  picture string is null or has an incorrect format.
118
 
119
   function Value (Date : String) return Ada.Calendar.Time;
120
   --  Parse the string Date and return its equivalent as a Time value. The
121
   --  following time format is supported:
122
   --
123
   --     hh:mm:ss             - Date is the current date
124
   --
125
   --  The following formats are also supported. They all accept an optional
126
   --  time with the format "hh:mm:ss". The time is separated from the date by
127
   --  exactly one space character.
128
   --
129
   --  When the time is not specified, it is set to 00:00:00. The delimiter '*'
130
   --  must be either '-' and '/' and both occurrences must use the same
131
   --  character.
132
   --
133
   --  Trailing characters (in particular spaces) are not allowed
134
   --
135
   --     yyyy*mm*dd           - ISO format
136
   --     yy*mm*dd             - Year is assumed to be 20yy
137
   --     mm*dd*yyyy           - (US date format)
138
   --     dd*mmm*yyyy          - month spelled out
139
   --     yyyy*mmm*dd          - month spelled out
140
   --     yyyymmdd             - Iso format, no separator
141
   --     mmm dd, yyyy         - month spelled out
142
   --     dd mmm yyyy          - month spelled out
143
   --
144
   --  Constraint_Error is raised if the input string is malformed (does not
145
   --  conform to one of the above dates, or has an invalid time string), or
146
   --  the resulting time is not valid.
147
 
148
   procedure Put_Time (Date : Ada.Calendar.Time; Picture : Picture_String);
149
   --  Put Date with format Picture. Raise Picture_Error if bad picture string
150
 
151
private
152
   ISO_Date      : constant Picture_String := "%Y-%m-%d";
153
   US_Date       : constant Picture_String := "%m/%d/%y";
154
   European_Date : constant Picture_String := "%d/%m/%y";
155
 
156
end GNAT.Calendar.Time_IO;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.