2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
8 // http://www.apache.org/licenses/LICENSE-2.0
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.
18 * @file FSysSystemTime.h
19 * @brief This is the header file for the %SystemTime class.
21 * This header file contains the declarations of the %SystemTime class.
24 #ifndef _FSYS_SYSTEM_TIME_H_
25 #define _FSYS_SYSTEM_TIME_H_
27 #include <FBaseObject.h>
28 #include <FBaseTimeSpan.h>
29 #include <FBaseDateTime.h>
31 namespace Tizen { namespace System
36 * @brief This class provides methods to get the system time.
40 * @final This class is not intended for extension.
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.
45 * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/system/systime.htm">System Time</a>.
51 * Defines the three types of time modes.
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 */
65 class _OSP_EXPORT_ SystemTime
70 * Gets the uptime in milliseconds since the system is booted.
74 * @return An error code
75 * @param[out] uptime The uptime in milliseconds
76 * @exception E_SUCCESS The method is successful.
78 static result GetUptime(Tizen::Base::TimeSpan& uptime);
81 * Gets the current system time.
85 * @return An error code
86 * @param[out] currentTime The current system time in UTC
87 * @exception E_SUCCESS The method is successful.
89 static result GetCurrentTime(Tizen::Base::DateTime& currentTime);
92 * Gets the current system time.
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.
101 static result GetCurrentTime(TimeMode timeMode, Tizen::Base::DateTime& currentTime);
104 * Gets the current system time in milliseconds since 1/1/1970 UTC.
108 * @return An error code
109 * @param[out] ticks The system time in milliseconds
110 * @exception E_SUCCESS The method is successful.
112 static result GetTicks(long long& ticks);
115 * Sets the current system time.
119 * @privlevel platform
120 * @privilege %http://tizen.org/privilege/settingmanager.write @n
121 * (%http://tizen.org/privilege/systemsetting.write is deprecated.)
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_