b311480e |
1 | -- Created on: 1993-01-04 |
2 | -- Created by: J.P. BOUDIER - J.P. TIRAULT |
3 | -- Copyright (c) 1993-1999 Matra Datavision |
973c2be1 |
4 | -- Copyright (c) 1999-2014 OPEN CASCADE SAS |
7fd59977 |
5 | -- |
973c2be1 |
6 | -- This file is part of Open CASCADE Technology software library. |
b311480e |
7 | -- |
d5f74e42 |
8 | -- This library is free software; you can redistribute it and/or modify it under |
9 | -- the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
10 | -- by the Free Software Foundation, with special exception defined in the file |
11 | -- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
12 | -- distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
13 | -- |
973c2be1 |
14 | -- Alternatively, this file may be used under the terms of Open CASCADE |
15 | -- commercial license or contractual agreement. |
7fd59977 |
16 | |
17 | class Period from Quantity |
18 | |
19 | ---Purpose: Manages date intervals. For example, a Period object |
20 | -- gives the interval between two dates. |
21 | -- A period is expressed in seconds and microseconds. |
22 | |
7fd59977 |
23 | raises PeriodDefinitionError |
24 | |
25 | is |
26 | |
27 | Create ( dd, hh, mn, ss : Integer ; mis , mics : Integer = 0) |
28 | returns Period |
29 | raises PeriodDefinitionError; |
30 | ---Purpose: Creates a Period |
31 | -- With: 0 <= dd |
32 | -- 0 <= hh |
33 | -- 0 <= mn |
34 | -- 0 <= ss |
35 | -- 0 <= mis |
36 | -- 0 <= mics |
37 | |
38 | Create ( ss : Integer; mics : Integer = 0 ) |
39 | returns Period |
40 | raises PeriodDefinitionError; |
41 | ---Purpose: Creates a Period with a number of seconds and microseconds. |
42 | -- Exceptions |
43 | -- Quantity_PeriodDefinitionError: |
44 | -- - if the number of seconds expressed either by: |
45 | -- - dd days, hh hours, mn minutes and ss seconds, or |
46 | -- - Ss |
47 | -- is less than 0. |
48 | -- - if the number of microseconds expressed either by: |
49 | -- - mis milliseconds and mics microseconds, or |
50 | -- - Mics |
51 | -- is less than 0. |
52 | |
53 | Values (me ; dd, hh, mn, ss, mis, mics : out Integer) is static; |
54 | ---Purpose: Decomposes this period into a number of days,hours, |
55 | -- minutes,seconds,milliseconds and microseconds |
56 | -- Example of return values: |
57 | -- 2 days, 15 hours, 0 minute , 0 second |
58 | -- 0 millisecond and 0 microsecond |
59 | |
60 | Values (me; ss , mics : out Integer) is static; |
61 | ---Purpose: Returns the number of seconds in Ss and the |
62 | -- number of remainding microseconds in Mics of this period. |
63 | -- Example of return values: 3600 seconds and 0 microseconds |
64 | |
65 | SetValues (me : out; dd,hh, mn, ss : Integer; mis, mics : Integer = 0) |
66 | is static; |
67 | ---Purpose: Assigns to this period the time interval defined |
68 | -- - with dd days, hh hours, mn minutes, ss |
69 | -- seconds, mis (defaulted to 0) milliseconds and |
70 | -- mics (defaulted to 0) microseconds; or |
71 | |
72 | SetValues (me : out; ss : Integer ; mics : Integer = 0 ) is static ; |
73 | ---Purpose: Assigns to this period the time interval defined |
74 | -- - with Ss seconds and Mics (defaulted to 0) microseconds. |
75 | -- Exceptions |
76 | -- Quantity_PeriodDefinitionError: |
77 | -- - if the number of seconds expressed either by: |
78 | -- - dd days, hh hours, mn minutes and ss seconds, or |
79 | -- - Ss |
80 | -- is less than 0. |
81 | -- - if the number of microseconds expressed either by: |
82 | -- - mis milliseconds and mics microseconds, or |
83 | -- - Mics |
84 | -- is less than 0. |
85 | |
86 | Subtract (me ; anOther : Period) returns Period is static; |
87 | ---Purpose: Subtracts one Period from another and returns the difference. |
88 | ---C++: alias operator - |
89 | |
90 | Add (me ; anOther : Period) returns Period is static; |
91 | ---Purpose: Adds one Period to another one. |
92 | ---C++: alias operator + |
93 | |
94 | |
95 | IsEqual (me ; anOther : Period) returns Boolean is static ; |
96 | ---Purpose: Returns TRUE if both <me> and <other> are equal. |
97 | ---C++: alias operator == |
98 | |
99 | IsShorter (me ; anOther : Period) returns Boolean is static; |
100 | ---Purpose: Returns TRUE if <me> is shorter than <other>. |
101 | ---C++: alias operator < |
102 | |
103 | IsLonger (me ; anOther : Period) returns Boolean is static; |
104 | ---Purpose: Returns TRUE if <me> is longer then <other>. |
105 | ---C++: alias operator > |
106 | |
107 | IsValid (myclass ; dd, hh, mn, ss : Integer ; mis , mics : Integer = 0) |
108 | returns Boolean; |
109 | ---Purpose: Checks the validity of a Period in form (dd,hh,mn,ss,mil,mic) |
110 | -- With: 0 <= dd |
111 | -- 0 <= hh |
112 | -- 0 <= mn |
113 | -- 0 <= ss |
114 | -- 0 <= mis |
115 | -- 0 <= mics |
116 | |
117 | IsValid (myclass ; ss : Integer ; mics : Integer = 0) |
118 | returns Boolean; |
119 | ---Purpose: Checks the validity of a Period in form (ss,mic) |
120 | -- With: 0 <= ss |
121 | -- 0 <= mics |
122 | |
123 | fields |
124 | mySec : Integer; |
125 | myUSec : Integer; |
126 | |
127 | end Period from Quantity; |
128 | |
129 | |