Fix logic for calculating next duetime considering DST 21/137221/1 accepted/tizen/3.0/common/20170707.091612 accepted/tizen/3.0/mobile/20170706.222111 accepted/tizen/3.0/wearable/20170706.222124 submit/tizen_3.0/20170705.085739 submit/tizen_3.0/20170705.090100
authordahyeong.kim <dahyeong.kim@samsung.com>
Mon, 3 Jul 2017 09:33:16 +0000 (18:33 +0900)
committerJiwoong Im <jiwoong.im@samsung.com>
Wed, 5 Jul 2017 02:19:55 +0000 (11:19 +0900)
Change-Id: Ib13caf4cfb694f7bf0b56d0d517a0f60f003ac4c
Signed-off-by: dahyeong.kim <dahyeong.kim@samsung.com>
Signed-off-by: Jiwoong Im <jiwoong.im@samsung.com>
alarm-manager-schedule.c

index 3f5e844..df593bd 100644 (file)
@@ -371,31 +371,29 @@ static time_t __alarm_next_duetime_weekly(__alarm_info_t *__alarm_info)
                due_time = mktime(&duetime_tm);
                localtime_r(&due_time, &tmp_tm);
 
-               SECURE_LOGD("%d:%d:%d. duetime = %d", tmp_tm.tm_hour, tmp_tm.tm_min, tmp_tm.tm_sec, due_time);
+               SECURE_LOGD("tm_isdst = 0 -> %d:%d:%d. duetime = %d", tmp_tm.tm_hour, tmp_tm.tm_min, tmp_tm.tm_sec, due_time);
                if (tmp_tm.tm_hour != start->hour || tmp_tm.tm_min != start->min || tmp_tm.tm_sec != start->sec) {
                        duetime_tm.tm_hour = start->hour;
                        duetime_tm.tm_min = start->min;
                        duetime_tm.tm_sec = start->sec;
                        duetime_tm.tm_isdst = -1;
                        due_time = mktime(&duetime_tm);
-                       ALARM_MGR_LOG_PRINT("due_time = %d", due_time);
-               }
-       } else {
-               if (current_dst == 1 && tmp_tm.tm_isdst == 1 && tmp_tm.tm_hour == start->hour + 1) {
-                       /* When the calculated duetime is forwarded 1hour due to DST, Adds 23hours. */
-                       due_time += 60 * 60 * 23;
-                       localtime_r(&due_time, &duetime_tm);
-                       ALARM_MGR_LOG_PRINT("due_time = %d", due_time);
+                       localtime_r(&due_time, &tmp_tm);
+                       SECURE_LOGD("tm_isdst = -1 -> %d:%d:%d. due_time = %d", tmp_tm.tm_hour, tmp_tm.tm_min, tmp_tm.tm_sec, due_time);
                }
        }
 
+       if (current_dst == 1 && tmp_tm.tm_isdst == 1 && tmp_tm.tm_hour == start->hour + 1) {
+               /* When the calculated duetime is forwarded 1hour due to DST, Adds 23hours. */
+               due_time += 60 * 60 * 23;
+               SECURE_LOGD("duetime + 23hour : due_time = %d", due_time);
+       }
+
        /* Gets the dst before calculating the duedate as interval */
        localtime_r(&due_time, &before_tm);
-       SECURE_LOGD("before_dst = %d", before_tm.tm_isdst);
-
-       wday = duetime_tm.tm_wday;
+       SECURE_LOGD("before_dst = %d -> %d:%d:%d. duetime = %d", before_tm.tm_isdst, before_tm.tm_hour, before_tm.tm_min, before_tm.tm_sec, due_time);
 
-       ALARM_MGR_LOG_PRINT("current_time(%d) due_time(%d)", current_time, due_time);
+       wday = before_tm.tm_wday;
 
        /* CQ defect(72810) : only one time alarm function is not working
           under all recurrence_disabled. */
@@ -424,7 +422,7 @@ static time_t __alarm_next_duetime_weekly(__alarm_info_t *__alarm_info)
 
        /* Gets the dst after calculating the duedate as interval */
        localtime_r(&due_time, &after_tm);
-       SECURE_LOGD("after_dst = %d", after_tm.tm_isdst);
+       SECURE_LOGD("after_dst = %d -> %d:%d:%d. duetime = %d", after_tm.tm_isdst, after_tm.tm_hour, after_tm.tm_min, after_tm.tm_sec, due_time);
 
        /* Revise the duetime as difference in tm_isdst */
        if (before_tm.tm_isdst == 1 && after_tm.tm_isdst == 0)