Remove pre-included windows portaudio static libs
[jack2.git] / macosx / uptime.c
blob7146fb52a722b93ae9a77433a679a535deccc195
1 #include <time.h>
2 #include <errno.h>
3 #include <sys/sysctl.h>
5 long uptime(void)
7 struct timeval boottime;
8 size_t len = sizeof(boottime);
9 int mib[2] = { CTL_KERN, KERN_BOOTTIME };
10 if (sysctl(mib, 2, &boottime, &len, NULL, 0) < 0)
12 return -1L;
14 time_t bsec = boottime.tv_sec, csec = time(NULL);
16 return (long) difftime(csec, bsec);