Add Android workaround for calculating the timezone UTC offset as on Android, we do not have the tm_gmtoff field of tm.
BUG=2093202

Change-Id: Icbcbe629322b109327390bd28114c6329ea0e351
diff --git a/src/platform-linux.cc b/src/platform-linux.cc
index 005b1de..247f43f 100644
--- a/src/platform-linux.cc
+++ b/src/platform-linux.cc
@@ -169,11 +169,29 @@
 
 
 double OS::LocalTimeOffset() {
+#if defined(ANDROID)
+  // Android does not have tm_gmtoff, so instead we'll work it out.
+  // Use a date in the local timezone representing 1st January 2010.
+  struct tm t;
+  t.tm_sec = 0;
+  t.tm_min = 0;
+  t.tm_hour = 0;
+  t.tm_mday = 1;
+  t.tm_mon = 0;
+  t.tm_year = 110;
+  t.tm_wday = 0;
+  t.tm_yday = 0;
+  t.tm_isdst = 0;
+  // 1262304000 is January, 1 2010 UTC.
+  time_t offset = 1262304000 - mktime(&t);
+  return static_cast<double>(offset * msPerSecond);
+#else
   time_t tv = time(NULL);
   struct tm* t = localtime(&tv);
   // tm_gmtoff includes any daylight savings offset, so subtract it.
   return static_cast<double>(t->tm_gmtoff * msPerSecond -
                              (t->tm_isdst > 0 ? 3600 * msPerSecond : 0));
+#endif
 }