mirror of
https://github.com/tio/tio.git
synced 2026-05-01 14:57:59 +02:00
Retired obsolete usleep()
Replaced with nanosleep()
This commit is contained in:
parent
f1fbab1673
commit
14fc053e8b
1 changed files with 6 additions and 1 deletions
|
|
@ -32,6 +32,7 @@
|
|||
#include <termios.h>
|
||||
#include <stdbool.h>
|
||||
#include <errno.h>
|
||||
#include <time.h>
|
||||
#include "tio/tty.h"
|
||||
#include "tio/print.h"
|
||||
#include "tio/options.h"
|
||||
|
|
@ -308,6 +309,8 @@ int connect_tty(void)
|
|||
|
||||
if (forward)
|
||||
{
|
||||
struct timespec ts;
|
||||
|
||||
/* Send output to tty device */
|
||||
status = write(fd, &output_char, 1);
|
||||
if (status < 0)
|
||||
|
|
@ -321,8 +324,10 @@ int connect_tty(void)
|
|||
tx_total++;
|
||||
|
||||
/* Insert output delay */
|
||||
ts.tv_sec = 0;
|
||||
ts.tv_nsec = option.output_delay * 1000000;
|
||||
if (option.output_delay)
|
||||
usleep(option.output_delay * 1000);
|
||||
nanosleep(&ts, NULL);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue