Introduce example program for viewing BBS art

This commit is contained in:
Justine Tunney 2024-10-13 17:43:39 -07:00
parent 2f4e6e8d77
commit 4b2a00fd4a
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
2 changed files with 217 additions and 5 deletions

View file

@ -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;
}