OSDN Git Service

- regenerate class files for updated copyright years
[pf3gnuchains/gcc-fork.git] / libjava / posix.cc
index 41702df..5d64094 100644 (file)
@@ -87,12 +87,20 @@ _Jv_platform_nanotime ()
   if (clock_gettime (id, &now) == 0)
     {
       jlong result = (jlong) now.tv_sec;
-      result = result * 1000 * 1000 + now.tv_nsec;
+      result = result * 1000000000LL + now.tv_nsec;
       return result;
     }
   // clock_gettime failed, but we can fall through.
 #endif // HAVE_CLOCK_GETTIME
-  return _Jv_platform_gettimeofday () * 1000LL;
+#if defined (HAVE_GETTIMEOFDAY)
+ {
+   timeval tv;
+   gettimeofday (&tv, NULL);
+   return (tv.tv_sec * 1000000000LL) + tv.tv_usec * 1000LL;
+ }
+#else
+  return _Jv_platform_gettimeofday () * 1000000LL;
+#endif
 }
 
 // Platform-specific VM initialization.
@@ -131,6 +139,10 @@ _Jv_platform_initProperties (java::util::Properties* newprops)
   if (! tmpdir)
     tmpdir = "/tmp";
   SET ("java.io.tmpdir", tmpdir);
+  const char *zoneinfodir = ::getenv("TZDATA");
+  if (! zoneinfodir)
+    zoneinfodir = "/usr/share/zoneinfo";
+  SET ("gnu.java.util.zoneinfo.dir", zoneinfodir);
 }
 
 static inline void
@@ -213,7 +225,7 @@ _Jv_select (int n, fd_set *readfds, fd_set  *writefds,
 // defined symbol to that address.  Returns 0 if no object defines this
 // address.
 int
-_Jv_platform_dladdr (const void *addr, _Jv_AddrInfo *info)
+_Jv_platform_dladdr (void *addr, _Jv_AddrInfo *info)
 {
   int ret_val = 0;