ref: d5ae75e18d3fd374910432809f062d5cfea5eb21
dir: /sys_macos.c/
#include <OSUtils.h> #include "flisp.h" #include "timefuncs.h" double sec_realtime(void) { struct timeval now; if(gettimeofday(&now, nil) != 0) return 0.0; return (double)now.tv_sec + (double)now.tv_usec/1.0e6; } /* * nsec() is wallclock and can be adjusted by timesync * so need to use cycles() instead, but fall back to * nsec() in case we can't */ uint64_t nanosec_monotonic(void) { return 0; } void timestring(double s, char *buf, int sz) { USED(s); USED(sz); buf[0] = 0; } double parsetime(const char *s) { USED(s); return 0.0; } void sleep_ms(int ms) { USED(ms); } int ftruncate(int f, off_t sz) { USED(f); USED(sz); return -1; } char * getcwd(char *buf, size_t len) { USED(buf); USED(len); return nil; } int chdir(const char *path) { USED(path); return -1; } int access(const char *path, int amode) { USED(path); USED(amode); return -1; } char os_version[10]; static const uint8_t boot[] = { #include "flisp.boot.h" }; int main(int argc, char **argv) { static SysEnvRec r; memset(&r, 0, sizeof(r)); SysEnvirons(2, &r); snprintf( os_version, sizeof(boot), "%d.%d.%d", r.systemVersion>>8, (r.systemVersion>>4)&0xf, (r.systemVersion>>0)&0xf ); flmain(boot, sizeof(boot), argc, argv); }