aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTadao Tanikawa <tanikawa.tadao@jp.panasonic.com>2018-07-19 11:56:51 +0000
committerTadao Tanikawa <tanikawa.tadao@jp.panasonic.com>2018-07-20 08:08:09 +0000
commitf25e25114ab2ef7e3019bfe4ff9b65ff93c41b90 (patch)
treeac1c4fadf6fb2b78fd522e145f346bc08beb6c8d /src
parentc6f9a9b8468b3746a3dec7ee2a0b7d84ec9fb44a (diff)
Fix timer
In 32bit environment, timer would be overflow. This causes that HomeScreen doesn't show on 32bit environment. Bug-AGL: SPEC-1471 Change-Id: I427da3a6e6ea76af05cee45a13b51754728a0cc5 Signed-off-by: Tadao Tanikawa <tanikawa.tadao@jp.panasonic.com>
Diffstat (limited to 'src')
-rw-r--r--src/window_manager.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/window_manager.cpp b/src/window_manager.cpp
index eadf7ff..5b86af8 100644
--- a/src/window_manager.cpp
+++ b/src/window_manager.cpp
@@ -30,7 +30,7 @@ extern "C"
namespace wm
{
-static const unsigned kTimeOut = 3000000UL; /* 3s */
+static const uint64_t kTimeOut = 3ULL; /* 3s */
/* DrawingArea name used by "{layout}.{area}" */
const char kNameLayoutNormal[] = "normal";
@@ -1452,12 +1452,18 @@ void WindowManager::emitScreenUpdated(unsigned req_num)
void WindowManager::setTimer()
{
+ struct timespec ts;
+ if (clock_gettime(CLOCK_BOOTTIME, &ts) != 0) {
+ HMI_ERROR("wm", "Could't set time (clock_gettime() returns with error");
+ return;
+ }
+
HMI_SEQ_DEBUG(g_app_list.currentRequestNumber(), "Timer set activate");
if (g_timer_ev_src == nullptr)
{
// firsttime set into sd_event
int ret = sd_event_add_time(afb_daemon_get_event_loop(), &g_timer_ev_src,
- CLOCK_REALTIME, time(NULL) * (1000000UL) + kTimeOut, 1, processTimerHandler, this);
+ CLOCK_BOOTTIME, (uint64_t)(ts.tv_sec + kTimeOut) * 1000000ULL, 1, processTimerHandler, this);
if (ret < 0)
{
HMI_ERROR("wm", "Could't set timer");
@@ -1466,7 +1472,7 @@ void WindowManager::setTimer()
else
{
// update timer limitation after second time
- sd_event_source_set_time(g_timer_ev_src, time(NULL) * (1000000UL) + kTimeOut);
+ sd_event_source_set_time(g_timer_ev_src, (uint64_t)(ts.tv_sec + kTimeOut) * 1000000ULL);
sd_event_source_set_enabled(g_timer_ev_src, SD_EVENT_ONESHOT);
}
}