summaryrefslogtreecommitdiff
path: root/i3status.c
diff options
context:
space:
mode:
authorMichael Stapelberg <stapelberg@users.noreply.github.com>2015-07-07 23:12:13 -0700
committerMichael Stapelberg <stapelberg@users.noreply.github.com>2015-07-07 23:12:13 -0700
commit55a23712ade74836be11feb9602f90d360aea44a (patch)
tree8de541c9dffaaf20f078807ca6489e6cbf211301 /i3status.c
parent326f26c5138526eccc7c57a22c3a1138e1535fcc (diff)
parent80e7b83d541044c698d6e9e40cc122e0cf287858 (diff)
Merge pull request #40 from afh/pull/osx
Mac OS X compatibility changes
Diffstat (limited to 'i3status.c')
-rw-r--r--i3status.c5
1 files changed, 5 insertions, 0 deletions
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;