From 2633e6f22b3de1030da5e65d5128672324ac9565 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Wed, 26 Nov 2014 16:29:41 +0000 Subject: add initial monotonic timer API --- include/nsutils/time.h | 31 +++++++++++++++++++++++++++++++ src/Makefile | 2 +- src/time.c | 25 +++++++++++++++++++++++++ 3 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 include/nsutils/time.h create mode 100644 src/time.c diff --git a/include/nsutils/time.h b/include/nsutils/time.h new file mode 100644 index 0000000..e07a670 --- /dev/null +++ b/include/nsutils/time.h @@ -0,0 +1,31 @@ +/* + * Copyright 2014 Vincent Sanders + * + * This file is part of libnsutils. + * + * Licensed under the MIT License, + * http://www.opensource.org/licenses/mit-license.php + */ + +/** + * \file + * Base64 encoding and decoding interface. + */ + +#ifndef NSUTILS_TIME_H_ +#define NSUTILS_TIME_H_ + +#include + +/** + * Get a monotonically incrementing number of milliseconds. + * + * Obtain a count of elapsed time in milliseconds. Unlike gettimeofday this + * will continue linearly across time setting and not go backwards, + * + * \param current The current value of the counter. + * \return NSERROR_OK on success else error code. + */ +nserror nsu_nsu_getmonotonic_ms(uint64_t *current); + +#endif diff --git a/src/Makefile b/src/Makefile index c5e0cbe..28bfc5f 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,3 +1,3 @@ -DIR_SOURCES := base64.c +DIR_SOURCES := base64.c time.c include $(NSBUILD)/Makefile.subdir diff --git a/src/time.c b/src/time.c new file mode 100644 index 0000000..c0a5dff --- /dev/null +++ b/src/time.c @@ -0,0 +1,25 @@ +/* + * Copyright 2014 Vincent Sanders + * + * This file is part of libnsutils. + * + * Licensed under the MIT License, + * http://www.opensource.org/licenses/mit-license.php + */ + +/** + * \file + * Time operation implementation + */ + +#include +#include +#include +#include + +#include "nsutils/time.h" + +nserror nsu_nsu_getmonotonic_ms(uint64_t *current) +{ + return NSERROR_NOT_IMPLEMENTED; +} -- cgit v1.2.3