Consolidate the implementation of TimeValue::now() for Unix to use the
authorReid Spencer <rspencer@reidspencer.com>
Mon, 15 Nov 2004 04:36:35 +0000 (04:36 +0000)
committerReid Spencer <rspencer@reidspencer.com>
Mon, 15 Nov 2004 04:36:35 +0000 (04:36 +0000)
seemingly ubiquitous gettimeofday(3) call.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17813 91177308-0d34-0410-b5e6-96231b3b80d8

lib/System/AIX/TimeValue.cpp
lib/System/Cygwin/TimeValue.cpp
lib/System/Darwin/TimeValue.cpp
lib/System/FreeBSD/TimeValue.cpp
lib/System/Interix/TimeValue.cpp
lib/System/Linux/TimeValue.cpp
lib/System/SunOS/TimeValue.cpp
lib/System/Unix/TimeValue.cpp
lib/System/Unix/TimeValue.inc

index 18fd4f31a1512d4bd2e465c82acf98c69a584793..42975ad2098b18354268ee499da65646d72b92e0 100644 (file)
@@ -12,7 +12,7 @@
 //===----------------------------------------------------------------------===//
 
 // Include the generic Unix implementation
-#include "../Unix/Unix.h"
+#include "../Unix/Unix.cpp"
 
 namespace llvm {
 using namespace sys;
@@ -22,8 +22,6 @@ using namespace sys;
 //===          and must not be generic UNIX code (see ../Unix/TimeValue.cpp)
 //===----------------------------------------------------------------------===//
 
-// FIXME: Need TimeValue::now()
-
 // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab
 
 }
index 6871551e8142836a5d8b0803489e0b8aac022c38..aaee13a1e31e7339bde6bbaf3e9f3ee5aca0cdd4 100644 (file)
@@ -12,7 +12,7 @@
 //===----------------------------------------------------------------------===//
 
 // Include the generic Unix implementation
-#include "../Unix/Unix.h"
+#include "../Unix/Unix.cpp"
 
 namespace llvm {
 using namespace sys;
@@ -22,8 +22,6 @@ using namespace sys;
 //===          and must not be generic UNIX code (see ../Unix/TimeValue.cpp)
 //===----------------------------------------------------------------------===//
 
-// FIXME: Need TimeValue::now()
-
 // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab
 
 }
index df27b9228ed15bbd2e20648c866053eb4d410855..0791f443aee149eb65807389c9b747e4d7552975 100644 (file)
@@ -12,7 +12,7 @@
 //===----------------------------------------------------------------------===//
 
 // Include the generic Unix implementation
-#include "../Unix/Unix.h"
+#include "../Unix/Unix.cpp"
 
 namespace llvm {
 using namespace sys;
@@ -22,8 +22,6 @@ using namespace sys;
 //===          and must not be generic UNIX code (see ../Unix/TimeValue.cpp)
 //===----------------------------------------------------------------------===//
 
-// FIXME: Need TimeValue::now()
-
 // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab
 
 }
index 79ed9a86336a58ac2e98e456771a2657b7db3e83..bade8387775a6e86a4a152aa714b9f0b6e16e632 100644 (file)
@@ -12,8 +12,7 @@
 //===----------------------------------------------------------------------===//
 
 // Include the generic Unix implementation
-#include "../Unix/Unix.h"
-#include <sys/time.h>
+#include "../Unix/Unix.cpp"
 
 namespace llvm {
 using namespace sys;
@@ -23,18 +22,6 @@ using namespace sys;
 //===          and must not be generic UNIX code (see ../Unix/TimeValue.cpp)
 //===----------------------------------------------------------------------===//
 
-TimeValue TimeValue::now() {
-  struct timeval the_time;
-  timerclear(&the_time);
-  if (0 != ::gettimeofday(&the_time,0)) 
-      ThrowErrno("Couldn't obtain time of day");
-
-  return TimeValue(
-    static_cast<TimeValue::SecondsType>( the_time.tv_sec +
-      PosixZeroTime.seconds_ ),
-    static_cast<TimeValue::NanoSecondsType>( the_time.tv_usec * 
-      NANOSECONDS_PER_MICROSECOND ) );
-}
 // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab
 
 }
index 6c4957f24bda11a8e0d4933c951271924ec0c1e2..60c7e0668eb89879ae3a57fe3c5cc3d5efe45bd0 100644 (file)
@@ -12,7 +12,7 @@
 //===----------------------------------------------------------------------===//
 
 // Include the generic Unix implementation
-#include "../Unix/Unix.h"
+#include "../Unix/Unix.cpp"
 
 namespace llvm {
 using namespace sys;
@@ -22,8 +22,6 @@ using namespace sys;
 //===          and must not be generic UNIX code (see ../Unix/TimeValue.cpp)
 //===----------------------------------------------------------------------===//
 
-// FIXME: Need TimeValue::now()
-
 // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab
 
 }
index d9745cc72d7432597c1a01099e557a80fb4d8211..8f52770e3ac9bb4e56d476082d1aa4bba31ba837 100644 (file)
@@ -14,8 +14,6 @@
 // Include the generic Unix implementation
 #include "../Unix/TimeValue.cpp"
 
-#include <sys/time.h>
-
 namespace llvm {
 
 using namespace sys;
@@ -25,17 +23,6 @@ using namespace sys;
 //===          and must not be generic UNIX code (see ../Unix/TimeValue.cpp)
 //===----------------------------------------------------------------------===//
 
-TimeValue TimeValue::now() {
-  struct timeval the_time;
-  timerclear(&the_time);
-  if (0 != ::gettimeofday(&the_time,0)) 
-      ThrowErrno("Couldn't obtain time of day");
-
-  return TimeValue(
-    static_cast<TimeValue::SecondsType>( the_time.tv_sec ), 
-    static_cast<TimeValue::NanoSecondsType>( the_time.tv_usec * 
-      NANOSECONDS_PER_MICROSECOND ) );
-}
 // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab
 
 }
index 8f44060f4755683e331d41d9c9643aff3d38e706..7e47331b3f64680339ef25d49b1b8a06d098f72b 100644 (file)
@@ -12,8 +12,7 @@
 //===----------------------------------------------------------------------===//
 
 // Include the generic Unix implementation
-#include "../Unix/Unix.h"
-#include <sys/time.h>
+#include "../Unix/Unix.cpp"
 
 namespace llvm {
 using namespace sys;
@@ -23,18 +22,6 @@ using namespace sys;
 //===          and must not be generic UNIX code (see ../Unix/TimeValue.cpp)
 //===----------------------------------------------------------------------===//
 
-TimeValue TimeValue::now() {
-  struct timeval the_time;
-  timerclear(&the_time);
-  if (0 != ::gettimeofday(&the_time,0)) 
-      ThrowErrno("Couldn't obtain time of day");
-
-  return TimeValue(
-    static_cast<TimeValue::SecondsType>( the_time.tv_sec ), 
-    static_cast<TimeValue::NanoSecondsType>( the_time.tv_usec * 
-      NANOSECONDS_PER_MICROSECOND ) );
-}
-
 // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab
 
 }
index f029f8dadca024d5a5dea520cd8c6cbb2f0f8f3f..6b476c86cad3003a8b5e21b346c34403f902cf92 100644 (file)
@@ -19,6 +19,7 @@
 #include "Unix.h"
 
 #include <time.h>
+#include <sys/time.h>
 
 namespace llvm {
   using namespace sys;
@@ -34,5 +35,17 @@ std::string TimeValue::toString() {
   return result.substr(0,24);
 }
 
+TimeValue TimeValue::now() {
+  struct timeval the_time;
+  ::timerclear(&the_time);
+  if (0 != ::gettimeofday(&the_time,0)) 
+    ThrowErrno("Couldn't obtain time of day");
+
+  return TimeValue(
+    static_cast<TimeValue::SecondsType>( the_time.tv_sec ), 
+    static_cast<TimeValue::NanoSecondsType>( the_time.tv_usec * 
+      NANOSECONDS_PER_MICROSECOND ) );
+}
+
 }
 // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab
index f029f8dadca024d5a5dea520cd8c6cbb2f0f8f3f..6b476c86cad3003a8b5e21b346c34403f902cf92 100644 (file)
@@ -19,6 +19,7 @@
 #include "Unix.h"
 
 #include <time.h>
+#include <sys/time.h>
 
 namespace llvm {
   using namespace sys;
@@ -34,5 +35,17 @@ std::string TimeValue::toString() {
   return result.substr(0,24);
 }
 
+TimeValue TimeValue::now() {
+  struct timeval the_time;
+  ::timerclear(&the_time);
+  if (0 != ::gettimeofday(&the_time,0)) 
+    ThrowErrno("Couldn't obtain time of day");
+
+  return TimeValue(
+    static_cast<TimeValue::SecondsType>( the_time.tv_sec ), 
+    static_cast<TimeValue::NanoSecondsType>( the_time.tv_usec * 
+      NANOSECONDS_PER_MICROSECOND ) );
+}
+
 }
 // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab