7#define _XOPEN_SOURCE 700
27char mouse[8] = { 0,0,0,0,0,0,0,0 };
37static uint64_t sys_time_start = 0;
41 QueryPerformanceCounter((LARGE_INTEGER*)&now);
42 return now - sys_time_start;
48 QueryPerformanceCounter((LARGE_INTEGER*)&sys_time_start);
55static uint64_t sys_time_start = 0;
59 clock_gettime(CLOCK_MONOTONIC_RAW, &ts);
60 return ((uint64_t)ts.tv_sec * 1000000000 + ts.tv_nsec) - sys_time_start;
66 clock_gettime(CLOCK_MONOTONIC_RAW, &ts);
67 sys_time_start = (uint64_t)ts.tv_sec * 1000000000 + ts.tv_nsec;
82#elif defined __APPLE__
84#include <objc/runtime.h>
85#include <objc/message.h>
90 SEL URLWithString = sel_registerName(
"URLWithString:");
91 SEL stringWithUTF8String = sel_registerName(
"stringWithUTF8String:");
92 SEL sharedWorkspace = sel_registerName(
"sharedWorkspace");
93 SEL openURL = sel_registerName(
"openURL:");
94 Class NSURL = objc_getClass(
"NSURL");
95 Class NSString = objc_getClass(
"NSString");
96 Class NSWorkspace = objc_getClass(
"NSWorkspace");
97 id url_nsstring = ((id(*)(Class, SEL,
char*))objc_msgSend)(NSString, stringWithUTF8String, url);
98 id ns_url = ((id(*)(Class, SEL, id))objc_msgSend)(NSURL, URLWithString, url_nsstring);
99 id workspace = ((id(*)(Class, SEL))objc_msgSend)(NSWorkspace, sharedWorkspace);
100 ((id(*)(id, SEL, id))objc_msgSend)(workspace, openURL, ns_url);
111 memset(buf, 0,
sizeof(
char) * c);
112 snprintf(buf, c,
"sensible-browser %s &", url);
void sys_browser(char *url)