diff options
Diffstat (limited to 'src/examples/dlt-example-user.c')
-rw-r--r-- | src/examples/dlt-example-user.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/examples/dlt-example-user.c b/src/examples/dlt-example-user.c index 19cf73f..45b9561 100644 --- a/src/examples/dlt-example-user.c +++ b/src/examples/dlt-example-user.c @@ -142,6 +142,7 @@ int main(int argc, char *argv[]) char *text; int num, maxnum; int delay; + struct timespec ts; int state = -1, newstate; @@ -311,9 +312,9 @@ int main(int argc, char *argv[]) maxnum = 10; if (dvalue) - delay = atoi(dvalue) * 1000; + delay = atoi(dvalue) * 1000000; else - delay = 500 * 1000; + delay = 500 * 1000000; if (tvalue) dlt_set_resend_timeout_atexit(atoi(tvalue)); @@ -378,8 +379,11 @@ int main(int argc, char *argv[]) DLT_LOG(mycontext1, lvalue, DLT_RAW(text, rvalue)); } - if (delay > 0) - usleep(delay); + if (delay > 0) { + ts.tv_sec = delay / 1000000000; + ts.tv_nsec = delay % 1000000000; + nanosleep(&ts, NULL); + } } sleep(1); |