mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-07-27 11:57:20 +08:00
parent
684cf3cdc2
commit
2a01430ba5
@ -37,6 +37,7 @@
|
|||||||
|
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
|
||||||
|
#include <limits.h>
|
||||||
#include <rtems/score/timespec.h>
|
#include <rtems/score/timespec.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -46,9 +47,14 @@ int
|
|||||||
tvtohz(struct timeval *tv)
|
tvtohz(struct timeval *tv)
|
||||||
{
|
{
|
||||||
struct timespec ts;
|
struct timespec ts;
|
||||||
|
uint32_t ticks;
|
||||||
|
|
||||||
ts.tv_sec = tv->tv_sec;
|
ts.tv_sec = tv->tv_sec;
|
||||||
ts.tv_nsec = tv->tv_usec * 1000;
|
ts.tv_nsec = tv->tv_usec * 1000;
|
||||||
|
|
||||||
return (int) _Timespec_To_ticks( &ts );
|
ticks = _Timespec_To_ticks(&ts);
|
||||||
|
if (ticks > INT_MAX)
|
||||||
|
ticks = INT_MAX;
|
||||||
|
|
||||||
|
return ticks;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user