examples/oneshot: fixed wrong constant and refactored
This commit is contained in:
parent
d656982f7a
commit
bf71741452
@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* examples/oneshot/oneshot_main.c
|
||||
* apps/examples/oneshot/oneshot_main.c
|
||||
*
|
||||
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
@ -178,9 +178,10 @@ int main(int argc, FAR char *argv[])
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
maxus = (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000;
|
||||
maxus = (uint64_t)ts.tv_sec * USEC_PER_SEC +
|
||||
(uint64_t)ts.tv_nsec / NSEC_PER_USEC;
|
||||
|
||||
printf("Maximum delay is %llu\n", maxus);
|
||||
printf("Maximum delay is %" PRIu64 "\n", maxus);
|
||||
|
||||
/* Ignore the default signal action */
|
||||
|
||||
@ -203,12 +204,11 @@ int main(int argc, FAR char *argv[])
|
||||
usecs);
|
||||
|
||||
start.pid = 0;
|
||||
|
||||
secs = usecs / 1000000;
|
||||
usecs -= 1000000 * secs;
|
||||
secs = usecs / USEC_PER_SEC;
|
||||
usecs -= USEC_PER_SEC * secs;
|
||||
|
||||
start.ts.tv_sec = secs;
|
||||
start.ts.tv_nsec = usecs * 1000;
|
||||
start.ts.tv_nsec = usecs * NSEC_PER_USEC;
|
||||
|
||||
start.event.sigev_notify = SIGEV_SIGNAL;
|
||||
start.event.sigev_signo = CONFIG_EXAMPLES_ONESHOT_SIGNO;
|
||||
|
Loading…
Reference in New Issue
Block a user