summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile6
-rw-r--r--main.cpp4
-rw-r--r--process.cpp1
3 files changed, 10 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 3edc3f0..3d4f9b3 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,8 @@
-CXX = g++
+ifeq ($(shell uname),Darwin)
+ CXX = g++-8
+else
+ CXX = g++
+endif
CXXFLAGS = -Wall -Wextra -O2 -std=c++17 -fwrapv -pthread
TARGET = competition
diff --git a/main.cpp b/main.cpp
index 5a6c779..3a801ba 100644
--- a/main.cpp
+++ b/main.cpp
@@ -69,7 +69,11 @@ static int64_t fileLastModified(const string_view fname) {
perror("stat");
exit(1);
}
+#ifdef __APPLE__
+ return st.st_mtimespec.tv_sec * 1000000LL + st.st_mtimespec.tv_nsec / 1000;
+#else
return st.st_mtim.tv_sec * 1000000LL + st.st_mtim.tv_nsec / 1000;
+#endif
}
static int64_t gettimestamp() {
diff --git a/process.cpp b/process.cpp
index 00a2e08..d3ceb28 100644
--- a/process.cpp
+++ b/process.cpp
@@ -1,6 +1,7 @@
#include <iostream>
#include <cstdlib>
#include <fcntl.h>
+#include <signal.h>
#include <sys/wait.h>
#include "process.h"
#include "error.h"