Issue: Sometimes visibility timer in UI updates from 5:00
to 4:58 directly and misses 4:59.
Cause: Use of API g_timeout_add_seconds, whose definition
says that the first call of the timer may not be precise
for timeouts of one second.
Fix: Use of API g_timeout_add resolves the problem
Change-Id: I4f53545b98474b20cdb0c0e1343148ccbd259856
#define BT_SEARCH_SERVICE_TIMEOUT 5
#define BT_SELECTED_TIMEOUT 5
#define BT_DELETED_TIMEOUT 2
#define BT_SEARCH_SERVICE_TIMEOUT 5
#define BT_SELECTED_TIMEOUT 5
#define BT_DELETED_TIMEOUT 2
+#define BT_VISIBILITY_TIMEOUT 1000
/* Define Error type */
#define BT_UG_FAIL -1
/* Define Error type */
#define BT_UG_FAIL -1
/* Set current time snapshot */
time(&(ugd->start_time));
ugd->remain_time = timeout;
/* Set current time snapshot */
time(&(ugd->start_time));
ugd->remain_time = timeout;
- ugd->timeout_id = g_timeout_add_seconds(1,
- __bt_main_visible_timeout_cb, ugd);
+ ugd->timeout_id = g_timeout_add(BT_VISIBILITY_TIMEOUT,
+ (GSourceFunc)__bt_main_visible_timeout_cb, ugd);
if (ugd->remain_time > 0) {
/* Set current time snapshot */
time(&(ugd->start_time));
if (ugd->remain_time > 0) {
/* Set current time snapshot */
time(&(ugd->start_time));
- ugd->timeout_id = g_timeout_add_seconds(1,
- __bt_main_visible_timeout_cb, ugd);
+ ugd->timeout_id = g_timeout_add(BT_VISIBILITY_TIMEOUT,
+ (GSourceFunc)__bt_main_visible_timeout_cb, ugd);
} else {
ugd->visibility_timeout = 0;
}
} else {
ugd->visibility_timeout = 0;
}