Indent, no functional change.
authorEmil Mikulic <emikulic@gmail.com>
Sun, 7 Dec 2014 06:19:03 +0000 (17:19 +1100)
committerEmil Mikulic <emikulic@gmail.com>
Sun, 7 Dec 2014 06:19:03 +0000 (17:19 +1100)
now.c

diff --git a/now.c b/now.c
index 3a2b3af..0bc0061 100644 (file)
--- a/now.c
+++ b/now.c
 #include <string.h>
 #include <time.h>
 
-#ifdef __MACH__
-/* Fake up clock_gettime() on OS X. */
-# include <sys/time.h>
-# include <inttypes.h>
-# include <mach/mach.h>
-# include <mach/mach_time.h>
-
-typedef int clockid_t;
-#define CLOCK_REALTIME 0
-#define CLOCK_MONOTONIC 1
-
-static uint64_t mono_first = 0;
-
-int clock_gettime(clockid_t clk_id, struct timespec *tp) {
-   if (clk_id == CLOCK_REALTIME) {
-      struct timeval tv;
-      gettimeofday(&tv, NULL);
-      tp->tv_sec = tv.tv_sec;
-      tp->tv_nsec = tv.tv_usec * 1000;
-      return 0;
-   }
-   if (clk_id == CLOCK_MONOTONIC) {
-      uint64_t t = mach_absolute_time();
-      mach_timebase_info_data_t timebase;
-      mach_timebase_info(&timebase);
-      if (!mono_first) {
-         mono_first = t;
+#ifdef __MACH__  /* Fake up clock_gettime() on OS X. */
+#  include <sys/time.h>
+#  include <inttypes.h>
+#  include <mach/mach.h>
+#  include <mach/mach_time.h>
+
+   typedef int clockid_t;
+#  define CLOCK_REALTIME 0
+#  define CLOCK_MONOTONIC 1
+
+   static uint64_t mono_first = 0;
+
+   int clock_gettime(clockid_t clk_id, struct timespec *tp) {
+      if (clk_id == CLOCK_REALTIME) {
+         struct timeval tv;
+         gettimeofday(&tv, NULL);
+         tp->tv_sec = tv.tv_sec;
+         tp->tv_nsec = tv.tv_usec * 1000;
+         return 0;
+      }
+      if (clk_id == CLOCK_MONOTONIC) {
+         uint64_t t = mach_absolute_time();
+         mach_timebase_info_data_t timebase;
+         mach_timebase_info(&timebase);
+         if (!mono_first) {
+            mono_first = t;
+         }
+         uint64_t tdiff = (t - mono_first) * timebase.numer / timebase.denom;
+         tp->tv_sec = tdiff / 1000000000;
+         tp->tv_nsec = tdiff % 1000000000;
+         return 0;
       }
-      uint64_t tdiff = (t - mono_first) * timebase.numer / timebase.denom;
-      tp->tv_sec = tdiff / 1000000000;
-      tp->tv_nsec = tdiff % 1000000000;
-      return 0;
+      return -1;
    }
-   return -1;
-}
 #endif  /* __MACH__ */
 
 static struct timespec clock_real, clock_mono;