Merge "Apply pkgs config for haptic" into tizen_2.1
[platform/framework/native/appfw.git] / inc / FSysSystemTime.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 /**
19  * @file        FSysSystemTime.h
20  * @brief       This is the header file for the %SystemTime class.
21  *
22  * This header file contains the declarations of the %SystemTime class.
23  */
24
25 #ifndef _FSYS_SYSTEM_TIME_H_
26 #define _FSYS_SYSTEM_TIME_H_
27
28 #include <FBaseObject.h>
29 #include <FBaseTimeSpan.h>
30 #include <FBaseDateTime.h>
31
32 namespace Tizen { namespace System
33 {
34
35 /**
36  * @class       SystemTime
37  * @brief       This class provides methods to get the system time.
38  *
39  * @since       2.0
40  *
41  * @final       This class is not intended for extension.
42  *
43  * The %SystemTime class provides methods to get the current system time, ticks, and uptime.
44  * It also supports the UTC, standard, and wall time modes.
45  *
46  * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/system/systime.htm">System Time</a>.
47  */
48
49 /**
50  * @enum        TimeMode
51  *
52  * Defines the three types of time modes.
53  *
54  * @since 2.0
55  */
56 enum TimeMode
57 {
58         UTC_TIME,       // This enum value is deprecated. Instead of using this enum value, use UTC_TIME.
59         STANDARD_TIME,  // This enum value is deprecated. Instead of using this enum value, use STANDARD_TIME.
60         WALL_TIME,      // This enum value is deprecated. Instead of using this enum value, use TIME_MODE_WALL.
61         TIME_MODE_UTC = UTC_TIME,               /**< The UTC Time */
62         TIME_MODE_STANDARD = STANDARD_TIME,     /**< The Standard Time */
63         TIME_MODE_WALL = WALL_TIME,             /**< The Wall Time */
64 };
65
66 class _OSP_EXPORT_ SystemTime
67 {
68
69 public:
70         /**
71          * Gets the uptime in milliseconds since the system is booted.
72          *
73          * @since       2.0
74          *
75          * @return      An error code
76          * @param[out]  uptime          The uptime in milliseconds
77          * @exception   E_SUCCESS       The method is successful.
78          */
79         static result GetUptime(Tizen::Base::TimeSpan& uptime);
80
81         /**
82          * Gets the current system time.
83          *
84          * @since       2.0
85          *
86          * @return      An error code
87          * @param[out]  currentTime     The current system time in UTC
88          * @exception   E_SUCCESS       The method is successful.
89          */
90         static result GetCurrentTime(Tizen::Base::DateTime& currentTime);
91
92         /**
93          * Gets the current system time.
94          *
95          * @since       2.0
96          *
97          * @return      An error code
98          * @param[in]   timeMode        The time mode @c TIME_MODE_UTC, @c TIME_MODE_STANDARD, or @c TIME_MODE_WALL
99          * @param[out]  currentTime     The current system time
100          * @exception   E_SUCCESS       The method is successful.
101          */
102         static result GetCurrentTime(TimeMode timeMode, Tizen::Base::DateTime& currentTime);
103
104         /**
105          * Gets the current system time in milliseconds since 1/1/1970 UTC.
106          *
107          * @since       2.0
108          *
109          * @return      An error code
110          * @param[out]  ticks           The system time in milliseconds
111          * @exception   E_SUCCESS       The method is successful.
112          */
113         static result GetTicks(long long& ticks);
114
115         /**
116          * Sets the current system time.
117          *
118          * @since 2.0
119          *
120          * @privlevel   platform
121          * @privilege   %http://tizen.org/privilege/systemsetting.write
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_