shithub: femtolisp

ref: 10d16c10bed72a177a99e0a9a3f3caca6c38ce94
dir: /sys_macos.c/

View raw version
#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;
}

static const uint8_t boot[] = {
#include "flisp.boot.h"
};

int
main(int argc, char **argv)
{
	flmain(boot, sizeof(boot), argc, argv);
}