AWS IoT Device SDK C: Platform
Platform portability layer
Return to main page ↑
iot_clock.h
Go to the documentation of this file.
1 /*
2  * IoT Platform V1.1.0
3  * Copyright (C) 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a copy of
6  * this software and associated documentation files (the "Software"), to deal in
7  * the Software without restriction, including without limitation the rights to
8  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9  * the Software, and to permit persons to whom the Software is furnished to do so,
10  * subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included in all
13  * copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21  */
22 
28 #ifndef IOT_CLOCK_H_
29 #define IOT_CLOCK_H_
30 
31 /* The config header is always included first. */
32 #include "iot_config.h"
33 
34 /* Standard includes. */
35 #include <stdbool.h>
36 #include <stddef.h>
37 #include <stdint.h>
38 
39 /* Platform layer types include. */
41 
88 /* @[declare_platform_clock_gettimestring] */
89 bool IotClock_GetTimestring( char * pBuffer,
90  size_t bufferSize,
91  size_t * pTimestringLength );
92 /* @[declare_platform_clock_gettimestring] */
93 
109 /* @[declare_platform_clock_gettimems] */
110 uint64_t IotClock_GetTimeMs( void );
111 /* @[declare_platform_clock_gettimems] */
112 
120 /* @[declare_platform_clock_sleepms] */
121 void IotClock_SleepMs( uint32_t sleepTimeMs );
122 /* @[declare_platform_clock_sleepms] */
123 
139 /* @[declare_platform_clock_timercreate] */
140 bool IotClock_TimerCreate( IotTimer_t * pNewTimer,
141  IotThreadRoutine_t expirationRoutine,
142  void * pArgument );
143 /* @[declare_platform_clock_timercreate] */
144 
158 /* @[declare_platform_clock_timerdestroy] */
159 void IotClock_TimerDestroy( IotTimer_t * pTimer );
160 /* @[declare_platform_clock_timerdestroy] */
161 
207 /* @[declare_platform_clock_timerarm] */
208 bool IotClock_TimerArm( IotTimer_t * pTimer,
209  uint32_t relativeTimeoutMs,
210  uint32_t periodMs );
211 /* @[declare_platform_clock_timerarm] */
212 
213 #endif /* ifndef IOT_CLOCK_H_ */
bool IotClock_TimerCreate(IotTimer_t *pNewTimer, IotThreadRoutine_t expirationRoutine, void *pArgument)
Create a new timer.
Types of the platform layer.
void IotClock_SleepMs(uint32_t sleepTimeMs)
Delay for the given number of milliseconds.
void IotClock_TimerDestroy(IotTimer_t *pTimer)
Free resources used by a timer.
bool IotClock_GetTimestring(char *pBuffer, size_t bufferSize, size_t *pTimestringLength)
Generates a human-readable timestring, such as "01 Jan 2018 12:00".
_IotSystemTimer_t IotTimer_t
The type used to represent timers, configured with the type _IotSystemTimer_t.
Definition: iot_platform_types.h:129
void(* IotThreadRoutine_t)(void *pArgument)
Thread routine function.
Definition: iot_platform_types.h:110
uint64_t IotClock_GetTimeMs(void)
Returns a nonzero, monotonically-increasing system time in milliseconds.
bool IotClock_TimerArm(IotTimer_t *pTimer, uint32_t relativeTimeoutMs, uint32_t periodMs)
Arm a timer to expire at the given relative timeout.