| 1 |
// Copyright (c) Microsoft. All rights reserved. |
| 2 |
// Licensed under the MIT license. See LICENSE file in the project root for full license information. |
| 3 |
|
| 4 |
#ifndef TICKCOUNTER_H |
| 5 |
#define TICKCOUNTER_H |
| 6 |
|
| 7 |
#ifdef __cplusplus |
| 8 |
#include <cstdint> |
| 9 |
#else |
| 10 |
#include <stdint.h> |
| 11 |
#endif |
| 12 |
|
| 13 |
#include "umock_c/umock_c_prod.h" |
| 14 |
|
| 15 |
#ifdef __cplusplus |
| 16 |
extern "C" |
| 17 |
{ |
| 18 |
#endif /* __cplusplus */ |
| 19 |
|
| 20 |
typedef uint_fast64_t tickcounter_ms_t; // Use 64-bit because of 32-bit is going to roll over back to zero after roughly 49.7 days that is not good for IoT devices which need keep running for months |
| 21 |
typedef struct TICK_COUNTER_INSTANCE_TAG *TICK_COUNTER_HANDLE; |
| 22 |
|
| 23 |
MOCKABLE_FUNCTION(, TICK_COUNTER_HANDLE, tickcounter_create); |
| 24 |
MOCKABLE_FUNCTION(, void, tickcounter_destroy, TICK_COUNTER_HANDLE, tick_counter); |
| 25 |
MOCKABLE_FUNCTION(, int, tickcounter_get_current_ms, TICK_COUNTER_HANDLE, tick_counter, tickcounter_ms_t *, current_ms); |
| 26 |
|
| 27 |
#ifdef __cplusplus |
| 28 |
} |
| 29 |
#endif /* __cplusplus */ |
| 30 |
|
| 31 |
#endif /* TICKCOUNTER_H */ |