From 11dcff42af77c2247ef9cc40bb37236de6221ca9 Mon Sep 17 00:00:00 2001
From: Steven Cahail <scahail@codeaurora.org>
Date: Fri, 11 Dec 2015 11:51:23 -0700
Subject: [PATCH] ipc_logging: Fix QTimer packing functions

Along with the unpack() functions which are present for parsing, the
classes which parse individual log messages also have pack() functions
which are used for recreating the log messages in their binary form.
These functions are used for unit testing.

In the TSVQTimer pack() function, incorrect math is performed on the
result before it is returned. In the LogMessageString pack() function, a
QTimer object is manipulated before it is created.

Fix these errors.

Change-Id: I5c288ddd53e468368c3663bdc9c1134a5f694865
---
 linux-ramdump-parser-v2/parsers/ipc_logging.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/linux-ramdump-parser-v2/parsers/ipc_logging.py b/linux-ramdump-parser-v2/parsers/ipc_logging.py
index b94345a..72294d8 100644
--- a/linux-ramdump-parser-v2/parsers/ipc_logging.py
+++ b/linux-ramdump-parser-v2/parsers/ipc_logging.py
@@ -268,7 +268,7 @@ class TsvQTimer(object):
         self.fTimestamp = fTimestamp
         tsv = LogTSV()
         data = tsv.pack(TSV_TYPE_QTIMER, 8)
-        data += struct.pack('<Q', fTimestamp * 1.0E9)
+        data += struct.pack('<Q', fTimestamp)
         return data
 
     def __str__(self):
@@ -381,6 +381,7 @@ class LogMessageString(object):
         data = self.timestamp.pack(fTimestamp)
 
         if fQTimer is not None:
+            self.qtimer = TsvQTimer()
             data += self.qtimer.pack(fQTimer)
 
         data += TsvByteArray().pack(strMessage)
-- 
GitLab