shithub: femtolisp

ref: 3c817d2e586dd916e39d54b2722c2e41a17c898d
dir: /sys_dos.c/

View raw version
#include "flisp.h"
#include "timefuncs.h"

double
sec_realtime(void)
{
	return 0.0;
}

uint64_t
nanosec_monotonic(void)
{
	return 0;
}

void
timestring(double s, char *buf, int sz)
{
	time_t tme = (time_t)s;
	struct tm tm;

	localtime_r(&tme, &tm);
	strftime(buf, sz, "%c", &tm);
}

double
parsetime(const char *s)
{
	return -1;
}

void
sleep_ms(int ms)
{
	if(ms != 0){
		struct timeval timeout;
		timeout.tv_sec = ms/1000;
		timeout.tv_usec = (ms % 1000) * 1000;
		select(0, nil, nil, nil, &timeout);
	}
}

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

int
main(int argc, char **argv)
{
	setlocale(LC_NUMERIC, "C");
	flmain(boot, sizeof(boot), argc, argv);
}