summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2014-11-29 16:20:40 (GMT)
committer Vincent Sanders <vince@kyllikki.org>2014-11-29 16:20:40 (GMT)
commitb662aee6b4a7743ba9ea904ff307ae9d3497bc2d (patch)
tree7e656a453c4a23b3a2aa619bc27ff02c3d6fa85b
parent2b03e4ea2f63bff82fb7caae455533bb9045bfbf (diff)
downloadlibnsutils-b662aee6b4a7743ba9ea904ff307ae9d3497bc2d.tar.gz
libnsutils-b662aee6b4a7743ba9ea904ff307ae9d3497bc2d.tar.bz2
Improve and document exact behaviour of the returned value.
-rw-r--r--include/nsutils/time.h10
-rw-r--r--src/time.c4
2 files changed, 9 insertions, 5 deletions
diff --git a/include/nsutils/time.h b/include/nsutils/time.h
index 93a4c1d..aa39d94 100644
--- a/include/nsutils/time.h
+++ b/include/nsutils/time.h
@@ -18,10 +18,14 @@
#include <nsutils/errors.h>
/**
- * Get a monotonically incrementing number of milliseconds.
+ * Get a monotonically incriminating number of milliseconds.
*
- * Obtain a count of elapsed time in milliseconds. Unlike gettimeofday this
- * will continue linearly across time setting and not go backwards,
+ * Obtain a count of elapsed time in milliseconds from an arbitrary point in
+ * time. Unlike gettimeofday this will continue linearly across time setting
+ * and not go backwards.
+ *
+ * \note The read value will always increment by at least 1 on each call meaning
+ * times less than 1ms cannot be differentiated.
*
* \param current The current value of the counter.
* \return NSERROR_OK on success else error code.
diff --git a/src/time.c b/src/time.c
index 5ea1d3f..736c982 100644
--- a/src/time.c
+++ b/src/time.c
@@ -69,8 +69,8 @@ nsuerror nsu_getmonotonic_ms(uint64_t *current_out)
*current_out = current;
prev = current;
} else {
- /** \todo is 10ms really correct or can we calculate a delta going forwards? */
- prev += 10;
+ /** \todo is 1ms really correct or can we calculate a delta going forwards? */
+ prev += 1;
*current_out = prev;
}
return NSUERROR_OK;