AWS IoT Device SDK C: Platform
Platform portability layer
Return to main page ↑
IotClock_GetTimestring

Generates a human-readable timestring, such as "01 Jan 2018 12:00".

bool IotClock_GetTimestring( char * pBuffer,
size_t bufferSize,
size_t * pTimestringLength );

This function uses the system clock to generate a human-readable timestring. This timestring is printed by the logging functions.

Parameters
[out]pBufferA buffer to store the timestring in.
[in]bufferSizeThe size of pBuffer.
[out]pTimestringLengthThe actual length of the timestring stored in pBuffer.
Returns
true if a timestring was successfully generated; false otherwise.
Warning
The implementation of this function must not call any logging functions.

Example

char timestring[ 32 ];
size_t timestringLength = 0;
if( IotClock_GetTimestring( timestring, 32, &timestringLength ) == true )
{
printf( "Timestring: %.*s", timestringLength, timestring );
}