logd: liblog: 64-bit issues

- structure packing
- move towards log_time from struct timespec
- extend log_time to cover differences between
  log_time and struct timespec

Change-Id: I106ed0b609917306d170044054b5b32645f2a295
diff --git a/logd/LogBuffer.cpp b/logd/LogBuffer.cpp
index 7340a36..c5760f7 100644
--- a/logd/LogBuffer.cpp
+++ b/logd/LogBuffer.cpp
@@ -36,7 +36,7 @@
     pthread_mutex_init(&mLogElementsLock, NULL);
 }
 
-void LogBuffer::log(log_id_t log_id, struct timespec realtime,
+void LogBuffer::log(log_id_t log_id, log_time realtime,
                     uid_t uid, pid_t pid, const char *msg,
                     unsigned short len) {
     if ((log_id >= LOG_ID_MAX) || (log_id < 0)) {
@@ -182,8 +182,8 @@
     return LOG_BUFFER_SIZE;
 }
 
-struct timespec LogBuffer::flushTo(
-        SocketClient *reader, const struct timespec start, bool privileged,
+log_time LogBuffer::flushTo(
+        SocketClient *reader, const log_time start, bool privileged,
         bool (*filter)(const LogBufferElement *element, void *arg), void *arg) {
     LogBufferElementCollection::iterator it;
     log_time max = start;
diff --git a/logd/LogBuffer.h b/logd/LogBuffer.h
index 7c69f1b..1b50a8f 100644
--- a/logd/LogBuffer.h
+++ b/logd/LogBuffer.h
@@ -40,12 +40,12 @@
 
     LogBuffer(LastLogTimes *times);
 
-    void log(log_id_t log_id, struct timespec realtime,
+    void log(log_id_t log_id, log_time realtime,
              uid_t uid, pid_t pid, const char *msg, unsigned short len);
-    struct timespec flushTo(SocketClient *writer, const struct timespec start,
-                            bool privileged,
-                            bool (*filter)(const LogBufferElement *element, void *arg) = NULL,
-                            void *arg = NULL);
+    log_time flushTo(SocketClient *writer, const log_time start,
+                     bool privileged,
+                     bool (*filter)(const LogBufferElement *element, void *arg) = NULL,
+                     void *arg = NULL);
 
     void clear(log_id_t id);
     unsigned long getSize(log_id_t id);
diff --git a/logd/LogBufferElement.cpp b/logd/LogBufferElement.cpp
index 1c55623..01cc9de 100644
--- a/logd/LogBufferElement.cpp
+++ b/logd/LogBufferElement.cpp
@@ -24,9 +24,11 @@
 #include "LogBufferElement.h"
 #include "LogReader.h"
 
-const struct timespec LogBufferElement::FLUSH_ERROR = { 0, 0 };
+const log_time LogBufferElement::FLUSH_ERROR(0, 0);
 
-LogBufferElement::LogBufferElement(log_id_t log_id, struct timespec realtime, uid_t uid, pid_t pid, const char *msg, unsigned short len)
+LogBufferElement::LogBufferElement(log_id_t log_id, log_time realtime,
+                                   uid_t uid, pid_t pid, const char *msg,
+                                   unsigned short len)
         : mLogId(log_id)
         , mUid(uid)
         , mPid(pid)
@@ -41,7 +43,7 @@
     delete [] mMsg;
 }
 
-struct timespec LogBufferElement::flushTo(SocketClient *reader) {
+log_time LogBufferElement::flushTo(SocketClient *reader) {
     struct logger_entry_v3 entry;
     memset(&entry, 0, sizeof(struct logger_entry_v3));
     entry.hdr_size = sizeof(struct logger_entry_v3);
diff --git a/logd/LogBufferElement.h b/logd/LogBufferElement.h
index 390c97c..1da09ae 100644
--- a/logd/LogBufferElement.h
+++ b/logd/LogBufferElement.h
@@ -32,7 +32,7 @@
     const log_time mRealTime;
 
 public:
-    LogBufferElement(log_id_t log_id, struct timespec realtime,
+    LogBufferElement(log_id_t log_id, log_time realtime,
                      uid_t uid, pid_t pid, const char *msg, unsigned short len);
     virtual ~LogBufferElement();
 
@@ -43,8 +43,8 @@
     log_time getMonotonicTime(void) const { return mMonotonicTime; }
     log_time getRealTime(void) const { return mRealTime; }
 
-    static const struct timespec FLUSH_ERROR;
-    struct timespec flushTo(SocketClient *writer);
+    static const log_time FLUSH_ERROR;
+    log_time flushTo(SocketClient *writer);
 };
 
 #endif