2 * Copyright (c) 2019 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.
17 using System.ComponentModel;
22 /// The WatchTime class is used to get time for the WatchApplication.<br/>
23 /// A WatchTime has a time handle from watch application framework.<br/>
24 /// You can get time(hour, minute, second, millisecond) and date(year, month, day)<br/>
25 /// on receiving timeTick signal.
27 /// <since_tizen> 4 </since_tizen>
28 public class WatchTime : Disposable
34 /// <since_tizen> 4 </since_tizen>
35 public WatchTime() : this(Interop.Watch.new_WatchTime(), true)
37 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
40 internal WatchTime(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
45 /// Get the current hour.
47 /// <remarks>The return value is always positive.The WatchTime needs to be initialized.</remarks>
48 /// <since_tizen> 4 </since_tizen>
58 /// Get the current hour24.
60 /// <remarks>The return value is always positive.The WatchTime needs to be initialized.</remarks>
61 /// <since_tizen> 4 </since_tizen>
71 /// Get the current minute.
73 /// <remarks>The return value is always positive.The WatchTime needs to be initialized.</remarks>
74 /// <since_tizen> 4 </since_tizen>
84 /// Get the current second.
86 /// <remarks>The return value is always positive.The WatchTime needs to be initialized.</remarks>
87 /// <since_tizen> 4 </since_tizen>
97 /// Get the current millisecond.
99 /// <remarks>The return value is always positive.The WatchTime needs to be initialized.</remarks>
100 /// <since_tizen> 4 </since_tizen>
101 public int Millisecond
105 return GetMillisecond();
110 /// Get the current year.
112 /// <remarks>The return value is always positive.The WatchTime needs to be initialized.</remarks>
113 /// <since_tizen> 4 </since_tizen>
123 /// Get the current month.
125 /// <remarks>The return value is always positive.The WatchTime needs to be initialized.</remarks>
126 /// <since_tizen> 4 </since_tizen>
136 /// Get the current day.
138 /// <remarks>The return value is always positive.The WatchTime needs to be initialized.</remarks>
139 /// <since_tizen> 4 </since_tizen>
149 /// Get the current week.
151 /// <remarks>The return value is always positive.The WatchTime needs to be initialized.</remarks>
152 /// <since_tizen> 4 </since_tizen>
157 return GetDayOfWeek();
162 /// Get the ID of timezone.
165 /// The WatchTime needs to be initialized.<br/>
166 /// The timezone ID, according to the IANA(Internet Assigned Numbers Authority)<br/>
167 /// If you want to see more information, please refer to the site :<br/>
168 /// https://en.wikipedia.org/wiki/List_of_tz_database_time_zones/
170 /// <since_tizen> 4 </since_tizen>
171 public string TimeZone
175 return GetTimeZone();
180 /// Get the daylight saving time status.
182 /// <remarks>The WatchTime needs to be initialized.</remarks>
183 /// <since_tizen> 4 </since_tizen>
184 public bool DaylightSavingTimeStatus
188 return GetDaylightSavingTimeStatus();
192 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(WatchTime obj)
194 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
197 internal static WatchTime GetWatchTimeFromPtr(global::System.IntPtr cPtr)
199 WatchTime ret = new WatchTime(cPtr, false);
200 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
204 internal int GetDayOfWeek()
206 int ret = Interop.Watch.WatchTime_GetDayOfWeek(swigCPtr);
207 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
211 internal SWIGTYPE_p_tm GetUtcTime()
213 SWIGTYPE_p_tm ret = new SWIGTYPE_p_tm(Interop.Watch.WatchTime_GetUtcTime(swigCPtr), true);
214 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
218 internal SWIGTYPE_p_time_t GetUtcTimeStamp()
220 SWIGTYPE_p_time_t ret = new SWIGTYPE_p_time_t(Interop.Watch.WatchTime_GetUtcTimeStamp(swigCPtr), true);
221 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
225 internal string GetTimeZone()
227 string ret = Interop.Watch.WatchTime_GetTimeZone(swigCPtr);
228 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
232 internal bool GetDaylightSavingTimeStatus()
234 bool ret = Interop.Watch.WatchTime_GetDaylightSavingTimeStatus(swigCPtr);
235 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
239 internal int GetHour()
241 int ret = Interop.Watch.WatchTime_GetHour(swigCPtr);
242 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
246 internal int GetHour24()
248 int ret = Interop.Watch.WatchTime_GetHour24(swigCPtr);
249 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
253 internal int GetMinute()
255 int ret = Interop.Watch.WatchTime_GetMinute(swigCPtr);
256 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
260 internal int GetSecond()
262 int ret = Interop.Watch.WatchTime_GetSecond(swigCPtr);
263 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
267 internal int GetMillisecond()
269 int ret = Interop.Watch.WatchTime_GetMillisecond(swigCPtr);
270 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
274 internal int GetYear()
276 int ret = Interop.Watch.WatchTime_GetYear(swigCPtr);
277 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
281 internal int GetMonth()
283 int ret = Interop.Watch.WatchTime_GetMonth(swigCPtr);
284 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
288 internal int GetDay()
290 int ret = Interop.Watch.WatchTime_GetDay(swigCPtr);
291 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
295 /// This will not be public opened.
296 [EditorBrowsable(EditorBrowsableState.Never)]
297 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
299 Interop.Watch.delete_WatchTime(swigCPtr);