Xin Zhang / azure-iot-c-sdk-f767zi

Dependents:   samplemqtt

Revision:
0:f7f1f0d76dd6
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/c-utility/inc/azure_c_shared_utility/tickcounter.h	Thu Aug 23 06:52:14 2018 +0000
@@ -0,0 +1,31 @@
+// Copyright (c) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+#ifndef TICKCOUNTER_H
+#define TICKCOUNTER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <stdint.h>
+
+#include "azure_c_shared_utility/umock_c_prod.h"
+
+#if _WIN32
+    typedef uint_fast64_t tickcounter_ms_t; // Use 64-bit because of QueryPerformanceCounter call
+#else
+    typedef uint_fast32_t tickcounter_ms_t;
+#endif
+
+    typedef struct TICK_COUNTER_INSTANCE_TAG* TICK_COUNTER_HANDLE;
+
+    MOCKABLE_FUNCTION(, TICK_COUNTER_HANDLE, tickcounter_create);
+    MOCKABLE_FUNCTION(, void, tickcounter_destroy, TICK_COUNTER_HANDLE, tick_counter);
+    MOCKABLE_FUNCTION(, int, tickcounter_get_current_ms, TICK_COUNTER_HANDLE, tick_counter, tickcounter_ms_t*, current_ms);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* TICKCOUNTER_H */