Use same timestamp for on-disk BT Snoop Log and in-memory BT Snooz Log

* Logcat uses gettimeofday for its timestamp, the same as on-disk BT
  Snoop log
* Although in-memory BT Snooz Log uses the same method to get time, it
  is calling it separately, resulting in mismatch between timestamps of
  two snoop logs
* This CL let them uses the same timestamp_us value and put the function
  definition to libosi
* Note that preserved on-disk BT Snoop logs timestamp postfix at
      btsnoop_hci_<timestamp>.log
  will be changed to microsecond since epoch at current device timezone
  instead of the shifted BT Snoop timestamp value
* New unit tests for gettimeofday

Bug: 35113514
Test: Make, unit tests, run BT activities and check both snoop logs
Change-Id: I5b3f87bc523b272ced2c69a4595d0e0cbe29bcb3
diff --git a/osi/src/time.cc b/osi/src/time.cc
index a36d411..0b7f3a1 100644
--- a/osi/src/time.cc
+++ b/osi/src/time.cc
@@ -18,6 +18,7 @@
 
 #define LOG_TAG "bt_osi_time"
 
+#include <sys/time.h>
 #include <time.h>
 
 #include "osi/include/time.h"
@@ -33,3 +34,10 @@
   return ((uint64_t)ts_now.tv_sec * 1000000L) +
          ((uint64_t)ts_now.tv_nsec / 1000);
 }
+
+uint64_t time_gettimeofday_us(void) {
+  struct timeval tv;
+  gettimeofday(&tv, NULL);
+  return static_cast<uint64_t>(tv.tv_sec) * 1000000ULL +
+         static_cast<uint64_t>(tv.tv_usec);
+}