ref: c8ff8d599f84e0209ed0c37e92b6e05f1d06995f
dir: /src/macos/sys.c/
#include <OSUtils.h>
#include "sl.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
 */
u64int
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, soffset sz)
{
	USED(f); USED(sz);
	return -1;
}
char *
getcwd(char *buf, usize 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 u8int boot[] = {
#include "sl.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
	);
	slmain(boot, sizeof(boot), argc, argv);
}