Commit 8812df0a authored by yoogx's avatar yoogx
Browse files

* Correct handling of overflow on nsec

parent 81545b29
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* *
* For more informations, please visit http://taste.tuxfamily.org/wiki * For more informations, please visit http://taste.tuxfamily.org/wiki
* *
* Copyright (C) 2007-2009 Telecom ParisTech, 2010-2015 ESA & ISAE. * Copyright (C) 2007-2009 Telecom ParisTech, 2010-2016 ESA & ISAE.
*/ */
#include <time.h> #include <time.h>
...@@ -143,7 +143,7 @@ int __po_hi_add_times (__po_hi_time_t* result, const __po_hi_time_t* left, const ...@@ -143,7 +143,7 @@ int __po_hi_add_times (__po_hi_time_t* result, const __po_hi_time_t* left, const
{ {
result->sec = left->sec + right->sec; result->sec = left->sec + right->sec;
result->nsec = left->nsec + right->nsec; result->nsec = left->nsec + right->nsec;
if (result->nsec > 1000000000) while (result->nsec > 1000000000)
{ {
result->sec = result->sec + 1; result->sec = result->sec + 1;
result->nsec = result->nsec - 1000000000; result->nsec = result->nsec - 1000000000;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment