ConOpSys V2970  P004.07
ANVILEX control operating system
System_Date.h
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 //! @file System_Date.h
3 //! @brief System date and time calss implementation.
4 //! @attention No special attention requered.
5 //! @copyright (C) 2015-2020 ANVILEX LLC
6 //! $HeadURL: https://192.168.3.4:8443/svn/P004_07/ConOpSys/Common/System_Date.h $
7 //! $Revision: 2944 $
8 //! $Date: 2022-02-26 10:45:42 +0500 (Sa, 26 Feb 2022) $
9 //! $Author: minch $
10 //------------------------------------------------------------------------------
11 //
12 // Redistribution and use in source and binary forms, with or without
13 // modification, are permitted provided that the following conditions are met:
14 //
15 // 1. Redistributions of source code must retain the above copyright notice,
16 // this list of conditions and the following disclaimer.
17 //
18 // 2. Redistributions in binary form must reproduce the above copyright notice,
19 // this list of conditions and the following disclaimer in the documentation
20 // and/or other materials provided with the distribution.
21 //
22 // 3. Neither the name of ANVILEX nor the names of its contributors may be
23 // used to endorse or promote products derived from this software without
24 // specific prior written permission.
25 //
26 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
27 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
30 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 // POSSIBILITY OF SUCH DAMAGE.
37 //
38 //------------------------------------------------------------------------------
39 
40 //------------------------------------------------------------------------------
41 // Protecting header files from mutual, recursive inclusion.
42 //------------------------------------------------------------------------------
43 
44 #pragma once
45 
46 //------------------------------------------------------------------------------
47 // Include standard libraries header files
48 //------------------------------------------------------------------------------
49 
50 //------------------------------------------------------------------------------
51 // Include thrid party header files
52 //------------------------------------------------------------------------------
53 
54 //------------------------------------------------------------------------------
55 // Include ConOpSys header files
56 //------------------------------------------------------------------------------
57 
58 #include "Defines.h"
59 
60 //------------------------------------------------------------------------------
61 // Include ConOpSys application header files
62 //------------------------------------------------------------------------------
63 
64 //------------------------------------------------------------------------------
65 // Macros
66 //------------------------------------------------------------------------------
67 
68 //------------------------------------------------------------------------------
69 // Class definitions
70 //------------------------------------------------------------------------------
71 
72 //! @brief System date and time class
74 {
75 
76  //----------------------------------------------------------------------------
77  // Public defines, methods and variables
78  //----------------------------------------------------------------------------
79 
80  public:
81 
82  //--------------------------------------------------------------------------
83  // Public definesn
84  //--------------------------------------------------------------------------
85 
86  //! @brief Date and time structure
87  typedef struct
88  {
89 
90  //! @brief Year
92 
93  //! @brief Month 1..12
95 
96  //! @brief Day 1..31
98 
99  //! @brief Hour 0..23
101 
102  //! @brief Minute 0..59
104 
105  //! @brief Secinds 0..59
107 
108  //! @brief Miliseconds 0..999
110 
111  //! @brief Flags
113 
115 
116  //--------------------------------------------------------------------------
117  // Public methods
118  //--------------------------------------------------------------------------
119 
120  //!-------------------------------------------------------------------------
121  //! @brief Class constructor method
122  //! @note None
123  //! \par Override
124  //! Not allowed
125  //! @attention Don't call this method directly.
126  //! \par UML diagram
127  //! @dotfile TDate_Time__TDate_Time.dt
128  //--------------------------------------------------------------------------
129 
130  TDate_Time();
131 
132 // TDate_Time( I32 i32_Source ); //!< Constructor method
133 // TDate_Time( DOUBLE double_Source );
134  TDate_Time( const TDate_Time &object_Source ); //!< Constructor method
135  TDate_Time( TDate_Time *object_Source ); //!< Constructor method
136  TDate_Time( TDate_Time_Structure *struct_Source ); //!< Constructor method
137 // TDate_Time* TDate_Time( const TDate_TimeBase& src ); //!< Constructor method
138 // TDate_Time* TDate_Time( const System::UnicodeString & src, TDate_Time::TDate_TimeFlag flag); //!< Constructor method
139  TDate_Time( U16 u16_Year, U16 u16_Month, U16 u16_Day ); //!< Constructor method
140  TDate_Time( U16 u16_Hour, U16 u16_Minute, U16 u16_Second, U16 u16_Milisecond ); //!< Constructor method
141  TDate_Time( U16 u16_Year, U16 u16_Month, U16 u16_Day, U16 u16_Hour, U16 u16_Minute, U16 u16_Second, U16 u16_Milisecond ); //!< Constructor method
142  TDate_Time( U64 u64_Source ); //!< Constructor method
143  ~TDate_Time(); //!< Destructor method
144 
145 
146  // Data processing methods
147  VOID Set_Default();
148  VOID Get( TDate_Time_Structure *struct_DateTime );
149  BOOL Set( TDate_Time_Structure struct_New_DateTime );
150  BOOL Set( TDate_Time_Structure *struct_New_DateTime );
151  BOOL Set( U16 u16_Year, U16 u16_Month, U16 u16_Day, U16 u16_Hour, U16 u16_Minute, U16 u16_Second, U16 u16_Milisecond );
154  U64 Get_As_CDT64();
156 
157 
159  VOID Increment_ms();
160 
162  U16 Last_Day_Of_Month_Leap_Year( U16 u16_Month );
163 
164  //----------------------------------------------------------------------------
165  // Protected defines, methods and variables
166  //----------------------------------------------------------------------------
167 
168  protected:
169 
170  //----------------------------------------------------------------------------
171  // Private defines, methods and variables
172  //----------------------------------------------------------------------------
173 
174  private:
175 
176  //--------------------------------------------------------------------------
177  // Private variables
178  //--------------------------------------------------------------------------
179 
180  //! @brief Date and time drorage structure
182 
183  //! @brief Date and time validity flag
185 
186 };
187 
188 //------------------------------------------------------------------------------
189 // End of file
190 //------------------------------------------------------------------------------
ConOpSys data type definitions header file.
int BOOL
Boolean datatype definition.
Definition: Defines.h:124
unsigned long long U64
Binary 64-Bit unsigned integer datatype defenition.
Definition: Defines.h:213
void VOID
Datatypesess datatype definition.
Definition: Defines.h:105
unsigned short U16
Binary 16-Bit unsigned integer datatype defenition.
Definition: Defines.h:193
System date and time class.
Definition: System_Date.h:74
U64 Get_Compressed_As_U64()
Definition: System_Date.cpp:577
VOID Increment_ms()
Definition: System_Date.cpp:710
VOID Get(TDate_Time_Structure *struct_DateTime)
Definition: System_Date.cpp:371
BOOL Is_Valid(TDate_Time_Structure struct_DateTime_Structure)
Definition: System_Date.cpp:351
TDate_Time()
Class constructor method.
Definition: System_Date.cpp:72
U16 Last_Day_Of_Month_Common_Year(U16 u16_Month)
Definition: System_Date.cpp:887
TDate_Time_Structure Convert_From_CDT64(U64 u64_Value)
Definition: System_Date.cpp:617
~TDate_Time()
Destructor method.
Definition: System_Date.cpp:321
BOOL bool_Valid
Date and time validity flag.
Definition: System_Date.h:184
TDate_Time_Structure * Get_Data()
Definition: System_Date.cpp:696
TDate_Time_Structure struct_DateTime_Structure
Date and time drorage structure.
Definition: System_Date.h:181
U64 Get_As_CDT64()
Definition: System_Date.cpp:660
BOOL Set(TDate_Time_Structure struct_New_DateTime)
Definition: System_Date.cpp:408
U16 Last_Day_Of_Month_Leap_Year(U16 u16_Month)
Definition: System_Date.cpp:904
VOID Set_Default()
Definition: System_Date.cpp:329
Date and time structure.
Definition: System_Date.h:88
U16 u16_Minute
Minute 0..59.
Definition: System_Date.h:103
U16 u16_Day
Day 1..31.
Definition: System_Date.h:97
U16 u16_Milisecond
Miliseconds 0..999.
Definition: System_Date.h:109
U16 u16_Flags
Flags.
Definition: System_Date.h:112
U16 u16_Year
Year.
Definition: System_Date.h:91
U16 u16_Hour
Hour 0..23.
Definition: System_Date.h:100
U16 u16_Month
Month 1..12.
Definition: System_Date.h:94
U16 u16_Second
Secinds 0..59.
Definition: System_Date.h:106