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.NewWatchTime(), 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 WatchTime GetWatchTimeFromPtr(global::System.IntPtr cPtr)
194 WatchTime ret = new WatchTime(cPtr, false);
195 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
199 internal int GetDayOfWeek()
201 int ret = Interop.Watch.WatchTimeGetDayOfWeek(SwigCPtr);
202 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
206 internal SWIGTYPE_p_tm GetUtcTime()
208 SWIGTYPE_p_tm ret = new SWIGTYPE_p_tm(Interop.Watch.WatchTimeGetUtcTime(SwigCPtr));
209 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
213 internal SWIGTYPE_p_time_t GetUtcTimeStamp()
215 SWIGTYPE_p_time_t ret = new SWIGTYPE_p_time_t(Interop.Watch.WatchTimeGetUtcTimeStamp(SwigCPtr));
216 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
220 internal string GetTimeZone()
222 string ret = Interop.Watch.WatchTimeGetTimeZone(SwigCPtr);
223 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
227 internal bool GetDaylightSavingTimeStatus()
229 bool ret = Interop.Watch.WatchTimeGetDaylightSavingTimeStatus(SwigCPtr);
230 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
234 internal int GetHour()
236 int ret = Interop.Watch.WatchTimeGetHour(SwigCPtr);
237 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
241 internal int GetHour24()
243 int ret = Interop.Watch.WatchTimeGetHour24(SwigCPtr);
244 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
248 internal int GetMinute()
250 int ret = Interop.Watch.WatchTimeGetMinute(SwigCPtr);
251 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
255 internal int GetSecond()
257 int ret = Interop.Watch.WatchTimeGetSecond(SwigCPtr);
258 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
262 internal int GetMillisecond()
264 int ret = Interop.Watch.WatchTimeGetMillisecond(SwigCPtr);
265 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
269 internal int GetYear()
271 int ret = Interop.Watch.WatchTimeGetYear(SwigCPtr);
272 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
276 internal int GetMonth()
278 int ret = Interop.Watch.WatchTimeGetMonth(SwigCPtr);
279 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
283 internal int GetDay()
285 int ret = Interop.Watch.WatchTimeGetDay(SwigCPtr);
286 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
290 /// This will not be public opened.
291 [EditorBrowsable(EditorBrowsableState.Never)]
292 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
294 Interop.Watch.DeleteWatchTime(swigCPtr);