]> git.mxchange.org Git - simgear.git/blobdiff - simgear/timing/lowleveltime.cxx
Canvas: fix element mouse hit detection with OSG 3.3.2.
[simgear.git] / simgear / timing / lowleveltime.cxx
index a550526924f798768125abeed3043cf1cff88d43..155b160a5955e8df23de8c2738e7cfde2fedef3b 100644 (file)
@@ -306,16 +306,11 @@ static void fgtzset_internal (int always, const char *tz)
     /* User specified the empty string; use UTC explicitly.  */
     tz = "Universal";
 
-#ifdef macintosh
-  /* as you well know, mac paths contain leading colon, this code
-     messes things up.... */
-#else
   /* A leading colon means "implementation defined syntax".
      We ignore the colon and always use the same algorithm:
      try a data file, and if none exists parse the 1003.1 syntax.  */
   if (tz && *tz == ':')
     ++tz;
-#endif
 
   /* Check whether the value changes since the last run.  */
   if (old_fgtz != NULL && tz != NULL && strcmp (tz, old_fgtz) == 0)
@@ -1139,3 +1134,24 @@ char *tzstring (const char* string)
 
   return strncpy (p, string, needed);
 }
+
+time_t sgGMTime()
+{
+    // this was created to fix:
+    // https://code.google.com/p/flightgear-bugs/issues/detail?id=1207
+    // however applying the code on Unix causes bug:
+    // https://code.google.com/p/flightgear-bugs/issues/detail?id=1301
+    // One solution would be to deinfe our own 'timegm' as suggested here:
+    // http://linux.die.net/man/3/timegm
+    // but for the moment we'll assume time(0) on Unix is UTC, and hence we
+    // return it directly.
+    
+       time_t now_sec = time(0);
+#if defined(SG_WINDOWS)
+    struct tm now;
+       now = *gmtime(&now_sec);
+    return mktime(&now);
+#else
+       return now_sec;
+#endif
+}