Merge pull request #460 from OpenEtherCATsociety/ArthurKetels-add_timespec
Arthur ketels add timespec
This commit is contained in:
commit
342ca8632c
|
@ -164,7 +164,7 @@ void add_timespec(struct timespec *ts, int64 addtime)
|
||||||
sec = (addtime - nsec) / NSEC_PER_SEC;
|
sec = (addtime - nsec) / NSEC_PER_SEC;
|
||||||
ts->tv_sec += sec;
|
ts->tv_sec += sec;
|
||||||
ts->tv_nsec += nsec;
|
ts->tv_nsec += nsec;
|
||||||
if ( ts->tv_nsec > NSEC_PER_SEC )
|
if ( ts->tv_nsec >= NSEC_PER_SEC )
|
||||||
{
|
{
|
||||||
nsec = ts->tv_nsec % NSEC_PER_SEC;
|
nsec = ts->tv_nsec % NSEC_PER_SEC;
|
||||||
ts->tv_sec += (ts->tv_nsec - nsec) / NSEC_PER_SEC;
|
ts->tv_sec += (ts->tv_nsec - nsec) / NSEC_PER_SEC;
|
||||||
|
|
|
@ -142,7 +142,7 @@ void add_timespec(struct timespec *ts, int64 addtime)
|
||||||
sec = (addtime - nsec) / NSEC_PER_SEC;
|
sec = (addtime - nsec) / NSEC_PER_SEC;
|
||||||
ts->tv_sec += sec;
|
ts->tv_sec += sec;
|
||||||
ts->tv_nsec += nsec;
|
ts->tv_nsec += nsec;
|
||||||
if ( ts->tv_nsec > NSEC_PER_SEC )
|
if ( ts->tv_nsec >= NSEC_PER_SEC )
|
||||||
{
|
{
|
||||||
nsec = ts->tv_nsec % NSEC_PER_SEC;
|
nsec = ts->tv_nsec % NSEC_PER_SEC;
|
||||||
ts->tv_sec += (ts->tv_nsec - nsec) / NSEC_PER_SEC;
|
ts->tv_sec += (ts->tv_nsec - nsec) / NSEC_PER_SEC;
|
||||||
|
|
Loading…
Reference in New Issue