mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-27 14:58:30 +00:00
Introduce example program for viewing BBS art
This commit is contained in:
parent
2f4e6e8d77
commit
4b2a00fd4a
2 changed files with 217 additions and 5 deletions
|
@ -34,10 +34,14 @@
|
|||
* @norestart
|
||||
*/
|
||||
int usleep(uint64_t micros) {
|
||||
errno_t err;
|
||||
struct timespec ts = timespec_frommicros(micros);
|
||||
err = clock_nanosleep(CLOCK_REALTIME, 0, &ts, 0);
|
||||
if (err)
|
||||
return errno = err, -1;
|
||||
// All OSes except OpenBSD return instantly on usleep(0). So we might
|
||||
// as well avoid system call overhead and helping OpenBSD work better
|
||||
if (micros) {
|
||||
errno_t err;
|
||||
struct timespec ts = timespec_frommicros(micros);
|
||||
err = clock_nanosleep(CLOCK_MONOTONIC, 0, &ts, 0);
|
||||
if (err)
|
||||
return errno = err, -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue