Time utility module implementation file. More...
#include "mcl_core/mcl_time_util.h"
#include "time_util.h"
#include "string_util.h"
#include "mcl_core/mcl_assert.h"
#include "mcl_core/mcl_memory.h"
Go to the source code of this file.
Macros | |
#define | GMTIME_R_EXISTS |
#define | TIMESTAMP_FIELD_COUNT 7 |
#define | TIMESTAMP_DATE_INDEX 2 |
Functions | |
mcl_error_t | mcl_time_util_convert_to_iso_8601_format (const time_t *time_value, char *iso8601_formatted_time) |
mcl_bool_t | mcl_time_util_validate_timestamp (const char *timestamp) |
void | time_util_get_time (mcl_time_t *current_time) |
Time utility module implementation file.
Definition in file time_util.c.
#define GMTIME_R_EXISTS |
Definition at line 16 of file time_util.c.
#define TIMESTAMP_DATE_INDEX 2 |
Definition at line 20 of file time_util.c.
Referenced by mcl_time_util_validate_timestamp().
#define TIMESTAMP_FIELD_COUNT 7 |
Definition at line 19 of file time_util.c.
Referenced by mcl_time_util_validate_timestamp().
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.
[in] | time_value | Number of seconds passed since reference time. |
[in,out] | iso8601_formatted_time | Time representation in ISO 8601 format, buffer size must be at least MCL_TIMESTAMP_LENGTH. |
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_bool_t mcl_time_util_validate_timestamp | ( | const char * | timestamp | ) |
This function validates timestamp in terms of format, length and time value.
[in] | timestamp | Timestamp value to be checked against yyyy-MM-ddTHH:mm:ss.SSSZ format. Ex:2016-04-26T08:06:25.317Z |
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.
void time_util_get_time | ( | mcl_time_t * | current_time | ) |
This function returns the time elapsed in terms of seconds since Jan 1, 1970 UTC until now.
[in] | current_time | Time value in seconds. |
Definition at line 129 of file time_util.c.
References MCL_DEBUG_ENTRY, and MCL_DEBUG_LEAVE.
Referenced by _create_self_issued_jwt_payload().