mcl_time_util.h File Reference

Time utility module interface header file. More...

Include dependency graph for mcl_time_util.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define MCL_TIMESTAMP_LENGTH   25
 

Functions

MCL_CORE_EXPORT mcl_error_t mcl_time_util_convert_to_iso_8601_format (const time_t *time_value, char *iso8601_formatted_time)
 
MCL_CORE_EXPORT mcl_bool_t mcl_time_util_validate_timestamp (const char *timestamp)
 

Detailed Description

Time utility module interface header file.

This module provides time utility functions for converting time values to ISO 8601 format and validating ISO 8601 formatted timestamps.

Definition in file mcl_time_util.h.

Macro Definition Documentation

#define MCL_TIMESTAMP_LENGTH   25

Function Documentation

MCL_CORE_EXPORT mcl_error_t mcl_time_util_convert_to_iso_8601_format ( const time_t *  time_value,
char *  iso8601_formatted_time 
)

This function converts time value to ISO 8601 date and time format.

Parameters
[in]time_valueNumber of seconds passed since reference time.
[in,out]iso8601_formatted_timeTime representation in ISO 8601 format, buffer size must be at least MCL_TIMESTAMP_LENGTH.
Returns
  • MCL_OK in case of success.
  • MCL_FAIL in case of an internal error in MCL.

Definition at line 22 of file time_util.c.

References MCL_ASSERT_CODE_MESSAGE, MCL_DEBUG, MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, MCL_FAIL, MCL_NULL, MCL_NULL_CHAR, MCL_NULL_CHAR_SIZE, MCL_OK, and MCL_TIMESTAMP_LENGTH.

MCL_CORE_EXPORT mcl_bool_t mcl_time_util_validate_timestamp ( const char *  timestamp)

This function validates timestamp in terms of format, length and time value.

Parameters
[in]timestampTimestamp value to be checked against yyyy-MM-ddTHH:mm:ss.SSSZ format. Ex:2016-04-26T08:06:25.317Z
Returns
  • MCL_TRUE in case timestamp is valid.
  • MCL_FALSE in case timestamp is not valid in terms of format, length or time value.

Definition at line 76 of file time_util.c.

References MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, MCL_NULL, MCL_NULL_CHAR_SIZE, MCL_TIMESTAMP_LENGTH, MCL_TRUE, string_util_strlen(), string_util_strtol(), TIMESTAMP_DATE_INDEX, and TIMESTAMP_FIELD_COUNT.

Here is the call graph for this function: