Flush app registry before releasing file lock
[platform/framework/native/appfw.git] / inc / FSysSystemTime.h
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Apache License, Version 2.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //     http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 /**
18  * @file        FSysSystemTime.h
19  * @brief       This is the header file for the %SystemTime class.
20  *
21  * This header file contains the declarations of the %SystemTime class.
22  */
23
24 #ifndef _FSYS_SYSTEM_TIME_H_
25 #define _FSYS_SYSTEM_TIME_H_
26
27 #include <FBaseObject.h>
28 #include <FBaseTimeSpan.h>
29 #include <FBaseDateTime.h>
30
31 namespace Tizen { namespace System
32 {
33
34 /**
35  * @class       SystemTime
36  * @brief       This class provides methods to get the system time.
37  *
38  * @since       2.0
39  *
40  * @final       This class is not intended for extension.
41  *
42  * The %SystemTime class provides methods to get the current system time, ticks, and uptime.
43  * It also supports the UTC, standard, and wall time modes.
44  *
45  * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/system/systime.htm">System Time</a>.
46  */
47
48 /**
49  * @enum        TimeMode
50  *
51  * Defines the three types of time modes.
52  *
53  * @since 2.0
54  */
55 enum TimeMode
56 {
57         UTC_TIME,       // This enum value is deprecated. Instead of using this enum value, use UTC_TIME.
58         STANDARD_TIME,  // This enum value is deprecated. Instead of using this enum value, use STANDARD_TIME.
59         WALL_TIME,      // This enum value is deprecated. Instead of using this enum value, use TIME_MODE_WALL.
60         TIME_MODE_UTC = UTC_TIME,                               /**< The UTC Time */
61         TIME_MODE_STANDARD = STANDARD_TIME,             /**< The Standard Time */
62         TIME_MODE_WALL = WALL_TIME,                             /**< The Wall Time */
63 };
64
65 class _OSP_EXPORT_ SystemTime
66 {
67
68 public:
69         /**
70          * Gets the uptime in milliseconds since the system is booted.
71          *
72          * @since       2.0
73          *
74          * @return      An error code
75          * @param[out]  uptime          The uptime in milliseconds
76          * @exception   E_SUCCESS       The method is successful.
77          */
78         static result GetUptime(Tizen::Base::TimeSpan& uptime);
79
80         /**
81          * Gets the current system time.
82          *
83          * @since       2.0
84          *
85          * @return      An error code
86          * @param[out]  currentTime     The current system time in UTC
87          * @exception   E_SUCCESS       The method is successful.
88          */
89         static result GetCurrentTime(Tizen::Base::DateTime& currentTime);
90
91         /**
92          * Gets the current system time.
93          *
94          * @since       2.0
95          *
96          * @return      An error code
97          * @param[in]   timeMode        The time mode which can be @c TIME_MODE_UTC, @c TIME_MODE_STANDARD, or @c TIME_MODE_WALL
98          * @param[out]  currentTime     The current system time
99          * @exception   E_SUCCESS       The method is successful.
100          */
101         static result GetCurrentTime(TimeMode timeMode, Tizen::Base::DateTime& currentTime);
102
103         /**
104          * Gets the current system time in milliseconds since 1/1/1970 UTC.
105          *
106          * @since       2.0
107          *
108          * @return      An error code
109          * @param[out]  ticks           The system time in milliseconds
110          * @exception   E_SUCCESS       The method is successful.
111          */
112         static result GetTicks(long long& ticks);
113
114         /**
115          * Sets the current system time.
116          *
117          * @since 2.0
118          *
119          * @privlevel   platform
120          * @privilege   %http://tizen.org/privilege/settingmanager.write @n
121          *                     (%http://tizen.org/privilege/systemsetting.write is deprecated.)
122          *
123          * @return      An error code
124          * @param[in]   currentTime                     The current system time in UTC
125          * @exception   E_SUCCESS                       The method is successful.
126          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
127          * @exception   E_SYSTEM                        The method cannot proceed due to a severe system error.
128          */
129         static result SetCurrentTime(const Tizen::Base::DateTime& currentTime);
130 private:
131         /**
132          * This is the default constructor for this class. This default constructor is intentionally declared as private so that only the platform can create an instance.
133          */
134         SystemTime(void);
135
136         /**
137          * This is the destructor for this class. This destructor overrides Tizen::Base::Object::~Object().
138          */
139         virtual ~SystemTime(void);
140
141         /**
142          * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
143          */
144         SystemTime(const SystemTime& value);
145
146         /**
147          * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
148          */
149         SystemTime& operator =(const SystemTime& value);
150
151 private:
152         friend class _SystemTimeImpl;
153         class _SystemTimeImpl* __pSystemTimeImpl;
154
155 }; // SystemTime
156
157 } } // Tizen::System
158
159 #endif // _FSYS_SYSTEM_TIME_H_