blob: 5aa5f0c56f8bdaef850786f9d45f7f5549783e1a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
/*
* $Id$
*/
#if HAVE_CONFIG_H
#include "config.h"
#endif
#include <assert.h>
#include <time.h>
#include <errno.h>
#include <rtems/system.h>
#include <rtems/score/isr.h>
#include <rtems/score/thread.h>
#include <rtems/score/tod.h>
#include <rtems/seterr.h>
#include <rtems/posix/time.h>
/*PAGE
*
* _POSIX_Timespec_to_interval
*/
Watchdog_Interval _POSIX_Timespec_to_interval(
const struct timespec *time
)
{
Watchdog_Interval ticks;
ticks = (time->tv_sec * TOD_MICROSECONDS_PER_SECOND) /
_TOD_Microseconds_per_tick;
ticks += (time->tv_nsec / TOD_NANOSECONDS_PER_MICROSECOND) /
_TOD_Microseconds_per_tick;
if (ticks)
return ticks;
return 1;
}
|