2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
9 // http://www.apache.org/licenses/LICENSE-2.0
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.
19 * @file FSysSystemTime.h
20 * @brief This is the header file for the %SystemTime class.
22 * This header file contains the declarations of the %SystemTime class.
25 #ifndef _FSYS_SYSTEM_TIME_H_
26 #define _FSYS_SYSTEM_TIME_H_
28 #include <FBaseObject.h>
29 #include <FBaseTimeSpan.h>
30 #include <FBaseDateTime.h>
32 namespace Tizen { namespace System
37 * @brief This class provides methods to get the system time.
41 * @final This class is not intended for extension.
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.
46 * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/system/systime.htm">System Time</a>.
52 * Defines the three types of time modes.
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 */
66 class _OSP_EXPORT_ SystemTime
71 * Gets the uptime in milliseconds since the system is booted.
75 * @return An error code
76 * @param[out] uptime The uptime in milliseconds
77 * @exception E_SUCCESS The method is successful.
79 static result GetUptime(Tizen::Base::TimeSpan& uptime);
82 * Gets the current system time.
86 * @return An error code
87 * @param[out] currentTime The current system time in UTC
88 * @exception E_SUCCESS The method is successful.
90 static result GetCurrentTime(Tizen::Base::DateTime& currentTime);
93 * Gets the current system time.
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.
102 static result GetCurrentTime(TimeMode timeMode, Tizen::Base::DateTime& currentTime);
105 * Gets the current system time in milliseconds since 1/1/1970 UTC.
109 * @return An error code
110 * @param[out] ticks The system time in milliseconds
111 * @exception E_SUCCESS The method is successful.
113 static result GetTicks(long long& ticks);
116 * Sets the current system time.
120 * @privlevel platform
121 * @privilege %http://tizen.org/privilege/systemsetting.write
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.
129 static result SetCurrentTime(const Tizen::Base::DateTime& currentTime);
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.
137 * This is the destructor for this class. This destructor overrides Tizen::Base::Object::~Object().
139 virtual ~SystemTime(void);
142 * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
144 SystemTime(const SystemTime& value);
147 * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
149 SystemTime& operator =(const SystemTime& value);
152 friend class _SystemTimeImpl;
153 class _SystemTimeImpl* __pSystemTimeImpl;
159 #endif // _FSYS_SYSTEM_TIME_H_