Revert of Add nanosecond timer. (https://codereview.chromium.org/250243002/)

Reason for revert:
breaks EVERYTHING

Original issue's description:
> Add nanosecond timer.
>
> I've been finding it hard to get enough resolution out of our existing timers when measuring really tiny pictures.
>
> BUG=skia:2378
>
> Committed: http://code.google.com/p/skia/source/detail?r=14362

R=bsalomon@google.com, bungeman@google.com, mtklein@chromium.org
TBR=bsalomon@google.com, bungeman@google.com, mtklein@chromium.org
NOTREECHECKS=true
NOTRY=true
BUG=skia:2378

Author: mtklein@google.com

Review URL: https://codereview.chromium.org/258703002

git-svn-id: http://skia.googlecode.com/svn/trunk@14364 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/core/SkTime.h b/include/core/SkTime.h
index c4a7d06..51616d4 100644
--- a/include/core/SkTime.h
+++ b/include/core/SkTime.h
@@ -28,9 +28,7 @@
     };
     static void GetDateTime(DateTime*);
 
-    static SkMSec GetMSecs() { return GetNSecs() / 1000000; }
-
-    static SkNSec GetNSecs();
+    static SkMSec GetMSecs();
 };
 
 #if defined(SK_DEBUG) && defined(SK_BUILD_FOR_WIN32)
diff --git a/include/core/SkTypes.h b/include/core/SkTypes.h
index 3a512ab..13450cd 100644
--- a/include/core/SkTypes.h
+++ b/include/core/SkTypes.h
@@ -315,10 +315,6 @@
 */
 #define SkMSec_LE(a, b)     ((int32_t)(a) - (int32_t)(b) <= 0)
 
-/** 64 bit value to hold nanosecond count
-*/
-typedef uint64_t SkNSec;
-
 /** The generation IDs in Skia reserve 0 has an invalid marker.
  */
 #define SK_InvalidGenID     0
diff --git a/src/ports/SkTime_Unix.cpp b/src/ports/SkTime_Unix.cpp
index cdf7f3d..f519a69 100644
--- a/src/ports/SkTime_Unix.cpp
+++ b/src/ports/SkTime_Unix.cpp
@@ -12,8 +12,10 @@
 #include <sys/time.h>
 #include <time.h>
 
-void SkTime::GetDateTime(DateTime* dt) {
-    if (dt) {
+void SkTime::GetDateTime(DateTime* dt)
+{
+    if (dt)
+    {
         time_t m_time;
         time(&m_time);
         struct tm* tstruct;
@@ -29,33 +31,9 @@
     }
 }
 
-#ifdef __MACH__
-#  include <mach/mach_time.h>
-
-namespace {
-
-struct ConversionFactor {
-    ConversionFactor() {
-        mach_timebase_info_data_t timebase;
-        mach_timebase_info(&timebase);
-        toNanos = (double) timebase.numer / timebase.denom;
-    }
-    double toNanos;
-};
-
-}  // namespace
-
-SkNSec SkTime::GetNSecs() {
-    static ConversionFactor convert;  // Since already know we're on Mac, this is threadsafe.
-    return mach_absolute_time() * convert.toNanos;
+SkMSec SkTime::GetMSecs()
+{
+    struct timeval tv;
+    gettimeofday(&tv, NULL);
+    return (SkMSec) (tv.tv_sec * 1000 + tv.tv_usec / 1000 ); // microseconds to milliseconds
 }
-
-#else  // Linux, presumably all others too
-
-SkNSec SkTime::GetNSecs() {
-    struct timespec time;
-    clock_gettime(CLOCK_MONOTONIC, &time);
-    return (SkNSec)(time.tv_sec * 1000000000 + time.tv_nsec);
-}
-
-#endif
diff --git a/src/ports/SkTime_win.cpp b/src/ports/SkTime_win.cpp
index a48a69e..37af9f2 100644
--- a/src/ports/SkTime_win.cpp
+++ b/src/ports/SkTime_win.cpp
@@ -9,7 +9,8 @@
 
 #include "SkTime.h"
 
-void SkTime::GetDateTime(DateTime* dt) {
+void SkTime::GetDateTime(DateTime* dt)
+{
     if (dt)
     {
         SYSTEMTIME      st;
@@ -25,12 +26,13 @@
     }
 }
 
-SkNSec SkTime::GetNSecs() {
+SkMSec SkTime::GetMSecs()
+{
     FILETIME        ft;
     LARGE_INTEGER   li;
     GetSystemTimeAsFileTime(&ft);
     li.LowPart  = ft.dwLowDateTime;
     li.HighPart = ft.dwHighDateTime;
     __int64 t  = li.QuadPart;       /* In 100-nanosecond intervals */
-    return (SkMSec)(t * 100);
+    return (SkMSec)(t / 10000);               /* In milliseconds */
 }
diff --git a/tools/bench_playback.cpp b/tools/bench_playback.cpp
index 534ad96..a5dfe50 100644
--- a/tools/bench_playback.cpp
+++ b/tools/bench_playback.cpp
@@ -40,7 +40,7 @@
                                                                 src.width() * sizeof(SkPMColor)));
     canvas->clipRect(SkRect::MakeWH(SkIntToScalar(FLAGS_tile), SkIntToScalar(FLAGS_tile)));
 
-    const SkNSec start = SkTime::GetNSecs();
+    const SkMSec start = SkTime::GetMSecs();
     for (int i = 0; i < FLAGS_loops; i++) {
         if (FLAGS_skr) {
             SkRecordDraw(record, canvas.get());
@@ -49,9 +49,9 @@
         }
     }
 
-    const SkNSec elapsed = SkTime::GetNSecs() - start;
-    const double nsPerLoop = elapsed / (double)FLAGS_loops;
-    printf("%u\t%s\n", SkToUInt(nsPerLoop), name);
+    const SkMSec elapsed = SkTime::GetMSecs() - start;
+    const double msPerLoop = elapsed / (double)FLAGS_loops;
+    printf("%6.2f\t%s\n", msPerLoop, name);
 }
 
 int tool_main(int argc, char** argv);
diff --git a/tools/bench_record.cpp b/tools/bench_record.cpp
index 712f63a..63139d6 100644
--- a/tools/bench_record.cpp
+++ b/tools/bench_record.cpp
@@ -56,7 +56,7 @@
 }
 
 static void bench_record(SkPicture* src, const char* name, SkBBHFactory* bbhFactory) {
-    const SkNSec start = SkTime::GetNSecs();
+    const SkMSec start = SkTime::GetMSecs();
     const int width  = src ? src->width()  : FLAGS_nullSize;
     const int height = src ? src->height() : FLAGS_nullSize;
 
@@ -80,9 +80,9 @@
         }
     }
 
-    const SkNSec elapsed = SkTime::GetNSecs() - start;
-    const double nsPerLoop = elapsed / (double)FLAGS_loops;
-    printf("%u\t%s\n", SkToUInt(nsPerLoop), name);
+    const SkMSec elapsed = SkTime::GetMSecs() - start;
+    const double msPerLoop = elapsed / (double)FLAGS_loops;
+    printf("%.2g\t%s\n", msPerLoop, name);
 }
 
 int tool_main(int argc, char** argv);