};
struct watch_app_context __context;
+static double __prev_target_tick = -1;
static void __on_ambient_tick(void *watchtime, void *data);
static void __on_ambient_changed(int ambient, void *data);
double term = 1.0;
double sec = 1.0;
int idx;
+ double target;
+
struct _watch_time_s timeinfo;
__get_timeinfo(&timeinfo);
cur_time_in_milli = timeinfo.hour24 * 60 * 60 * 1000 + timeinfo.minute * 60 * 1000 +
- timeinfo.minute * 60 * 1000 + timeinfo.second * 1000 + timeinfo.millisecond;
+ timeinfo.second * 1000 + timeinfo.millisecond;
if (app_tick_type == WATCH_APP_TIME_TICKS_PER_SECOND) {
term = (double)ONE_SECOND / (double)app_tick_resolution;
}
idx = cur_time_in_milli / term;
- sec = (((idx + 1) * term) - cur_time_in_milli) / 1000.0;
+ target = (idx + 1) * term;
+
+ if (__prev_target_tick == target)
+ target = __prev_target_tick + term;
+
+ sec = (target - cur_time_in_milli) / 1000.0;
+ __prev_target_tick = target;
return sec;
}
if (watch_tick) {
ecore_timer_del(watch_tick);
watch_tick = NULL;
+ __prev_target_tick = -1;
}
}