From 483d8a28c46d44a7b4426ac746283059b4baba77 Mon Sep 17 00:00:00 2001 From: Nikita Kalyazin Date: Sat, 5 Oct 2013 20:08:52 +0400 Subject: [PATCH] [FIX] time parsing (fix sec/nsec order) Change-Id: I6e24c39ce9ad53aa7eef6a3bdc2261d30944df23 Signed-off-by: Nikita Kalyazin --- daemon/da_protocol.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/daemon/da_protocol.c b/daemon/da_protocol.c index 2b7783f..d2f31b2 100644 --- a/daemon/da_protocol.c +++ b/daemon/da_protocol.c @@ -525,17 +525,16 @@ static int parse_timeval(struct msg_buf_t *msg, struct timeval *tv) parse_deb("time\n"); - // FIXME: is sec/usec order correct? - if (!parse_int32(msg, &nsec)) { - LOGE("usec parsing error\n"); + if (!parse_int32(msg, (uint32_t *)&tv->tv_sec)) { + LOGE("sec parsing error\n"); return 0; } - tv->tv_usec = nsec / 1000; - if (!parse_int32(msg, (uint32_t *)&tv->tv_sec)) { - LOGE("sec parsing error\n"); + if (!parse_int32(msg, &nsec)) { + LOGE("usec parsing error\n"); return 0; } + tv->tv_usec = nsec / 1000; return 1; } -- 2.7.4