toaruos/userspace/core/sleep.c
Kevin Lange 22f04f137b Relatively compliant uname() implementation
Also, sleep() as a function (implemented by way of nanosleep) and new
absolute and relative sleep system calls added to newlib.

[ci skip] I damn well know this is going to break CI.
2013-03-13 21:55:25 -07:00

28 lines
425 B
C

/*
* Sleep
*/
#include <stdio.h>
#include <stdlib.h>
#include <syscall.h>
int main(int argc, char ** argv) {
int ret = 0;
char * arg = strdup(argv[1]);
float time = atof(arg);
unsigned int seconds = (unsigned int)time;
unsigned int subsecs = (unsigned int)((time - (float)seconds) * 100);
ret = syscall_nanosleep(seconds, subsecs);
return ret;
}
/*
* vim:tabstop=4
* vim:noexpandtab
* vim:shiftwidth=4
*/