Mercurial > hg > CbC > CbC_gcc
comparison gcc/ada/libgnat/a-calcon.ads @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | |
children | 84e7813d76e9 |
comparison
equal
deleted
inserted
replaced
68:561a7518be6b | 111:04ced10e8804 |
---|---|
1 ------------------------------------------------------------------------------ | |
2 -- -- | |
3 -- GNAT RUN-TIME COMPONENTS -- | |
4 -- -- | |
5 -- A D A . C A L E N D A R . C O N V E R S I O N S -- | |
6 -- -- | |
7 -- S p e c -- | |
8 -- -- | |
9 -- Copyright (C) 2008-2017, Free Software Foundation, Inc. -- | |
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 3, 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. -- | |
17 -- -- | |
18 -- As a special exception under Section 7 of GPL version 3, you are granted -- | |
19 -- additional permissions described in the GCC Runtime Library Exception, -- | |
20 -- version 3.1, as published by the Free Software Foundation. -- | |
21 -- -- | |
22 -- You should have received a copy of the GNU General Public License and -- | |
23 -- a copy of the GCC Runtime Library Exception along with this program; -- | |
24 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- | |
25 -- <http://www.gnu.org/licenses/>. -- | |
26 -- -- | |
27 -- GNAT was originally developed by the GNAT team at New York University. -- | |
28 -- Extensive contributions were provided by Ada Core Technologies Inc. -- | |
29 -- -- | |
30 ------------------------------------------------------------------------------ | |
31 | |
32 -- This package provides various routines for conversion between Ada and Unix | |
33 -- time models - Time, Duration, struct tm and struct timespec. | |
34 | |
35 with Interfaces.C; | |
36 | |
37 package Ada.Calendar.Conversions is | |
38 | |
39 function To_Ada_Time (Unix_Time : Interfaces.C.long) return Time; | |
40 -- Convert a time value represented as number of seconds since the | |
41 -- Unix Epoch to a time value relative to an Ada implementation-defined | |
42 -- Epoch. The units of the result are nanoseconds on all targets. Raises | |
43 -- Time_Error if the result cannot fit into a Time value. | |
44 | |
45 function To_Ada_Time | |
46 (tm_year : Interfaces.C.int; | |
47 tm_mon : Interfaces.C.int; | |
48 tm_day : Interfaces.C.int; | |
49 tm_hour : Interfaces.C.int; | |
50 tm_min : Interfaces.C.int; | |
51 tm_sec : Interfaces.C.int; | |
52 tm_isdst : Interfaces.C.int) return Time; | |
53 -- Convert a time value expressed in Unix-like fields of struct tm into | |
54 -- a Time value relative to the Ada Epoch. The ranges of the formals are | |
55 -- as follows: | |
56 | |
57 -- tm_year -- years since 1900 | |
58 -- tm_mon -- months since January [0 .. 11] | |
59 -- tm_day -- day of the month [1 .. 31] | |
60 -- tm_hour -- hours since midnight [0 .. 24] | |
61 -- tm_min -- minutes after the hour [0 .. 59] | |
62 -- tm_sec -- seconds after the minute [0 .. 60] | |
63 -- tm_isdst -- Daylight Savings Time flag [-1 .. 1] | |
64 | |
65 -- The returned value is in UTC and may or may not contain leap seconds | |
66 -- depending on whether binder flag "-y" was used. Raises Time_Error if | |
67 -- the input values are out of the defined ranges or if tm_sec equals 60 | |
68 -- and the instance in time is not a leap second occurrence. | |
69 | |
70 function To_Duration | |
71 (tv_sec : Interfaces.C.long; | |
72 tv_nsec : Interfaces.C.long) return Duration; | |
73 -- Convert an elapsed time value expressed in Unix-like fields of struct | |
74 -- timespec into a Duration value. The expected ranges are: | |
75 | |
76 -- tv_sec - seconds | |
77 -- tv_nsec - nanoseconds | |
78 | |
79 procedure To_Struct_Timespec | |
80 (D : Duration; | |
81 tv_sec : out Interfaces.C.long; | |
82 tv_nsec : out Interfaces.C.long); | |
83 -- Convert a Duration value into the constituents of struct timespec. | |
84 -- Formal tv_sec denotes seconds and tv_nsecs denotes nanoseconds. | |
85 | |
86 procedure To_Struct_Tm | |
87 (T : Time; | |
88 tm_year : out Interfaces.C.int; | |
89 tm_mon : out Interfaces.C.int; | |
90 tm_day : out Interfaces.C.int; | |
91 tm_hour : out Interfaces.C.int; | |
92 tm_min : out Interfaces.C.int; | |
93 tm_sec : out Interfaces.C.int); | |
94 -- Convert a Time value set in the Ada Epoch into the constituents of | |
95 -- struct tm. The ranges of the out formals are as follows: | |
96 | |
97 -- tm_year -- years since 1900 | |
98 -- tm_mon -- months since January [0 .. 11] | |
99 -- tm_day -- day of the month [1 .. 31] | |
100 -- tm_hour -- hours since midnight [0 .. 24] | |
101 -- tm_min -- minutes after the hour [0 .. 59] | |
102 -- tm_sec -- seconds after the minute [0 .. 60] | |
103 -- tm_isdst -- Daylight Savings Time flag [-1 .. 1] | |
104 | |
105 -- The input date is considered to be in UTC | |
106 | |
107 function To_Unix_Time (Ada_Time : Time) return Interfaces.C.long; | |
108 -- Convert a time value represented as number of time units since the Ada | |
109 -- implementation-defined Epoch to a value relative to the Unix Epoch. The | |
110 -- units of the result are seconds. Raises Time_Error if the result cannot | |
111 -- fit into a Time value. | |
112 | |
113 end Ada.Calendar.Conversions; |