Skip to content

Patch to compile on OSX #7

@DanielO

Description

@DanielO

These are in addition to the one from issue #5 .

diff --git a/include/arch/cc.h b/include/arch/cc.h
index 9866cc3..ece3d52 100644
--- a/include/arch/cc.h
+++ b/include/arch/cc.h
@@ -6,7 +6,7 @@
 #include <stdint.h>
 #include <string.h>
 #include <sys/time.h>
-#include <endian.h>
+//#include <endian.h>

 typedef uint8_t     u8_t;
 typedef int8_t      s8_t;
diff --git a/src/libevent.c b/src/libevent.c
index 746887b..0e4424a 100644
--- a/src/libevent.c
+++ b/src/libevent.c
@@ -74,8 +74,8 @@ u32_t
 sys_now(void)
 {
   struct timespec tp;
-  /* CLOCK_BOOTTIME includes time spent in suspend */
-  clock_gettime(CLOCK_BOOTTIME, &tp);
+  /* CLOCK_MONOTONIC includes time spent in suspend */
+  clock_gettime(CLOCK_MONOTONIC, &tp);
   return tp.tv_sec * 1000 + tp.tv_nsec / 1000000;
 }

I don't know if Linux supports CLOCK_MONOTONIC with the same semantics as OSX - if it does that would be best to use IMO.

The #include can probably be dealt with via an #ifdef

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions