diff options
author | Jiwoong Im <jiwoong.im@samsung.com> | 2016-09-28 22:43:25 +0900 |
---|---|---|
committer | Jiwoong Im <jiwoong.im@samsung.com> | 2016-09-28 22:43:25 +0900 |
commit | 3cc4dd5b56ca704a4620fe89855da449750281db (patch) | |
tree | 5e13a9c65bdd9487dd1cb26e0281957fc32b43b7 | |
parent | 66804408240f1c312d1af9d4b9d05dce6c5231ef (diff) | |
download | alarm-manager-accepted/tizen/wearable/20160929.081515.tar.gz alarm-manager-accepted/tizen/wearable/20160929.081515.tar.bz2 alarm-manager-accepted/tizen/wearable/20160929.081515.zip |
fix bug in __set_time functionsubmit/tizen/20160929.002630accepted/tizen/wearable/20160929.081515accepted/tizen/tv/20160929.081459accepted/tizen/mobile/20160929.081527accepted/tizen/ivi/20160929.081522accepted/tizen/common/20160929.163036
Change-Id: I93f9d532935f831251e22fae4c9d33624e14c20a
Signed-off-by: Jiwoong Im <jiwoong.im@samsung.com>
-rw-r--r-- | alarm-manager.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/alarm-manager.c b/alarm-manager.c index 8258c8d..c7a7c3c 100644 --- a/alarm-manager.c +++ b/alarm-manager.c @@ -269,6 +269,18 @@ int __set_time(time_t _time) int ret = 0; struct timeval tv; struct tm tm, *gmtime_res; + + tv.tv_sec = _time; + tv.tv_usec = 0; + + gmtime_res = gmtime_r(&(tv.tv_sec), &tm); + if (!gmtime_res) + ALARM_MGR_EXCEPTION_PRINT("gmtime_r is failed. [%d]", errno); + + ret = settimeofday(&tv, NULL); + if (ret < 0) + ALARM_MGR_EXCEPTION_PRINT("settimeofday is failed.[%d]", errno); + #ifdef _APPFW_FEATURE_WAKEUP_USING_RTC /* Using /dev/alarm, this function changes both OS time and RTC. */ const char *rtc0 = default_rtc; @@ -322,16 +334,6 @@ int __set_time(time_t _time) #else ALARM_MGR_LOG_PRINT("[alarm-server] RTC does not work."); #endif /* _APPFW_FEATURE_WAKEUP_USING_RTC */ - tv.tv_sec = _time; - tv.tv_usec = 0; - - gmtime_res = gmtime_r(&(tv.tv_sec), &tm); - if (!gmtime_res) - ALARM_MGR_EXCEPTION_PRINT("gmtime_r is failed. [%d]", errno); - - ret = settimeofday(&tv, NULL); - if (ret < 0) - ALARM_MGR_EXCEPTION_PRINT("settimeofday is failed.[%d]", errno); return 1; } |