AWS IoT FreeRTOS+POSIX
utils.h
Go to the documentation of this file.
1 /*
2  * Amazon FreeRTOS+POSIX V1.0.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  * http://aws.amazon.com/freertos
23  * http://www.FreeRTOS.org
24  */
25 
31 #ifndef _FREERTOS_POSIX_UTILS_
32 #define _FREERTOS_POSIX_UTILS_
33 
34 /* C standard library includes. */
35 #include <stdbool.h>
36 #include <stdint.h>
37 
38 /* FreeRTOS+POSIX includes. */
39 #include "FreeRTOS_POSIX/time.h"
40 
50 size_t UTILS_strnlen( const char * const pcString,
51  size_t xMaxLength );
52 
64 int UTILS_AbsoluteTimespecToTicks( const struct timespec * const pxAbsoluteTime,
65  TickType_t * const pxResult );
66 
76 int UTILS_TimespecToTicks( const struct timespec * const pxTimespec,
77  TickType_t * const pxResult );
78 
87 void UTILS_NanosecondsToTimespec( int64_t llSource,
88  struct timespec * const pxDestination );
89 
99 int UTILS_TimespecAdd( struct timespec * const pxResult,
100  const struct timespec * const x,
101  const struct timespec * const y );
102 
112 int UTILS_TimespecAddNanoseconds( struct timespec * const pxResult,
113  const struct timespec * const x,
114  int64_t llNanoseconds );
115 
125 int UTILS_TimespecSubtract( struct timespec * const pxResult,
126  const struct timespec * const x,
127  const struct timespec * const y );
128 
138 bool UTILS_ValidateTimespec( const struct timespec * const pxTimespec );
139 
140 #endif /* ifndef _FREERTOS_POSIX_UTILS_ */
Time types.
represents an elapsed time
Definition: time.h:78