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.
21 /// The WatchTime class is used to get time for the WatchApplication.<br/>
22 /// A WatchTime has a time handle from watch application framework.<br/>
23 /// You can get time(hour, minute, second, millisecond) and date(year, month, day)<br/>
24 /// on receiving timeTick signal.
26 /// <since_tizen> 4 </since_tizen>
27 public class WatchTime : Disposable
32 /// <since_tizen> 4 </since_tizen>
33 protected bool swigCMemOwn;
35 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
40 /// <since_tizen> 4 </since_tizen>
41 public WatchTime() : this(Interop.Watch.new_WatchTime(), true)
43 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
46 internal WatchTime(global::System.IntPtr cPtr, bool cMemoryOwn)
48 swigCMemOwn = cMemoryOwn;
49 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
53 /// Get the current hour.
55 /// <remarks>The return value is always positive.The WatchTime needs to be initialized.</remarks>
56 /// <since_tizen> 4 </since_tizen>
66 /// Get the current hour24.
68 /// <remarks>The return value is always positive.The WatchTime needs to be initialized.</remarks>
69 /// <since_tizen> 4 </since_tizen>
79 /// Get the current minute.
81 /// <remarks>The return value is always positive.The WatchTime needs to be initialized.</remarks>
82 /// <since_tizen> 4 </since_tizen>
92 /// Get the current second.
94 /// <remarks>The return value is always positive.The WatchTime needs to be initialized.</remarks>
95 /// <since_tizen> 4 </since_tizen>
105 /// Get the current millisecond.
107 /// <remarks>The return value is always positive.The WatchTime needs to be initialized.</remarks>
108 /// <since_tizen> 4 </since_tizen>
109 public int Millisecond
113 return GetMillisecond();
118 /// Get the current year.
120 /// <remarks>The return value is always positive.The WatchTime needs to be initialized.</remarks>
121 /// <since_tizen> 4 </since_tizen>
131 /// Get the current month.
133 /// <remarks>The return value is always positive.The WatchTime needs to be initialized.</remarks>
134 /// <since_tizen> 4 </since_tizen>
144 /// Get the current day.
146 /// <remarks>The return value is always positive.The WatchTime needs to be initialized.</remarks>
147 /// <since_tizen> 4 </since_tizen>
157 /// Get the current week.
159 /// <remarks>The return value is always positive.The WatchTime needs to be initialized.</remarks>
160 /// <since_tizen> 4 </since_tizen>
165 return GetDayOfWeek();
170 /// Get the ID of timezone.
173 /// The WatchTime needs to be initialized.<br/>
174 /// The timezone ID, according to the IANA(Internet Assigned Numbers Authority)<br/>
175 /// If you want to see more information, please refer to the site :<br/>
176 /// https://en.wikipedia.org/wiki/List_of_tz_database_time_zones/
178 /// <since_tizen> 4 </since_tizen>
179 public string TimeZone
183 return GetTimeZone();
188 /// Get the daylight saving time status.
190 /// <remarks>The WatchTime needs to be initialized.</remarks>
191 /// <since_tizen> 4 </since_tizen>
192 public bool DaylightSavingTimeStatus
196 return GetDaylightSavingTimeStatus();
200 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(WatchTime obj)
202 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
205 internal static WatchTime GetWatchTimeFromPtr(global::System.IntPtr cPtr)
207 WatchTime ret = new WatchTime(cPtr, false);
208 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
212 internal int GetDayOfWeek()
214 int ret = Interop.Watch.WatchTime_GetDayOfWeek(swigCPtr);
215 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
219 internal SWIGTYPE_p_tm GetUtcTime()
221 SWIGTYPE_p_tm ret = new SWIGTYPE_p_tm(Interop.Watch.WatchTime_GetUtcTime(swigCPtr), true);
222 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
226 internal SWIGTYPE_p_time_t GetUtcTimeStamp()
228 SWIGTYPE_p_time_t ret = new SWIGTYPE_p_time_t(Interop.Watch.WatchTime_GetUtcTimeStamp(swigCPtr), true);
229 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
233 internal string GetTimeZone()
235 string ret = Interop.Watch.WatchTime_GetTimeZone(swigCPtr);
236 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
240 internal bool GetDaylightSavingTimeStatus()
242 bool ret = Interop.Watch.WatchTime_GetDaylightSavingTimeStatus(swigCPtr);
243 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
247 internal int GetHour()
249 int ret = Interop.Watch.WatchTime_GetHour(swigCPtr);
250 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
254 internal int GetHour24()
256 int ret = Interop.Watch.WatchTime_GetHour24(swigCPtr);
257 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
261 internal int GetMinute()
263 int ret = Interop.Watch.WatchTime_GetMinute(swigCPtr);
264 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
268 internal int GetSecond()
270 int ret = Interop.Watch.WatchTime_GetSecond(swigCPtr);
271 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
275 internal int GetMillisecond()
277 int ret = Interop.Watch.WatchTime_GetMillisecond(swigCPtr);
278 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
282 internal int GetYear()
284 int ret = Interop.Watch.WatchTime_GetYear(swigCPtr);
285 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
289 internal int GetMonth()
291 int ret = Interop.Watch.WatchTime_GetMonth(swigCPtr);
292 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
296 internal int GetDay()
298 int ret = Interop.Watch.WatchTime_GetDay(swigCPtr);
299 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
304 /// you can override it to clean-up your own resources.
306 /// <param name="type">DisposeTypes</param>
307 /// <since_tizen> 4 </since_tizen>
308 protected override void Dispose(DisposeTypes type)
315 //Release your own unmanaged resources here.
316 //You should not access any managed member here except static instance.
317 //because the execution order of Finalizes is non-deterministic.
319 if (swigCPtr.Handle != global::System.IntPtr.Zero)
324 Interop.Watch.delete_WatchTime(swigCPtr);
326 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);