From: Alexis Hildebrandt Date: Mon, 6 Jul 2015 13:39:34 +0000 (+0200) Subject: Use gettimeofday instead of clock_gettime on Mac X-Git-Tag: 2.10~25^2~1 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=2113737107c537e9cbc1a40d2d8d5fac5152e03e;p=i3%2Fi3status Use gettimeofday instead of clock_gettime on Mac since the latter is not available. --- diff --git a/i3status.c b/i3status.c index 46d557c..000584a 100644 --- a/i3status.c +++ b/i3status.c @@ -692,7 +692,12 @@ int main(int argc, char *argv[]) { * We also align to 60 seconds modulo interval such * that we start with :00 on every new minute. */ struct timespec ts; +#if defined(__APPLE__) + gettimeofday(&tv, NULL); + ts.tv_sec = tv.tv_sec; +#else clock_gettime(CLOCK_REALTIME, &ts); +#endif ts.tv_sec += interval - (ts.tv_sec % interval); ts.tv_nsec = 0;