21 DEBUG_ENTRY(
"const time_t *time_value = <%p>, string_t **iso8601_formatted_time = <%p>", time_value, iso8601_formatted_time)
24 struct tm *time_structure;
26 #if defined(WIN32) || defined(WIN64) 36 #if defined(WIN32) || defined(WIN64) 37 result = gmtime_s(time_structure, time_value);
40 temp = gmtime_r(time_value, time_structure);
49 if (0 == strftime((*iso8601_formatted_time)->buffer, (*iso8601_formatted_time)->length,
"%Y-%m-%dT%H:%M:%S.000Z", time_structure))
52 MCL_DEBUG(
"File creation time can not be converted to ISO-8601 date and time format.");
63 DEBUG_ENTRY(
"mcl_time_t *current_time = <%p>", current_time)
73 DEBUG_ENTRY(
"const char *timestamp = <%p>", timestamp)
75 const char characters_to_check[7] = {
'-',
'-',
'T',
':',
':',
'.',
'Z' };
76 const uint16_t maximum_values[7] = { 2999, 12, 31, 23, 59, 59, 999 };
77 const uint8_t character_indexes_to_check[7] = { 4, 7, 10, 13, 16, 19, 23 };
78 const char *temporary_buffer = timestamp;
84 const mcl_size_t expected_timestamp_length = 24;
88 ok = expected_timestamp_length == actual_timestamp_length;
91 for (index = 0; index < 7; ++index)
93 ok = ok && characters_to_check[index] == timestamp[character_indexes_to_check[index]];
97 for (index = 0; index < 7; ++index)
102 ok = ok && maximum_values[index] >= temporary_value;
107 ok = ok && temporary_value > 0;
111 temporary_buffer = end_pointer + 1;
void string_destroy(string_t **string)
Destroys the allocated resources of the string.
Memory module header file.
long string_util_strtol(const char *source, int base, char **end_pointer)
Returns the first occurrence of an integral value in source string.
E_MCL_ERROR_CODE string_initialize_new(const char *value, mcl_size_t value_length, string_t **string)
Initializes a new string_t object with the given value and length.
Log utility module header file.
E_MCL_ERROR_CODE
MCL Error code definitions. Every function returning an error code uses this enum values...
#define ASSERT_STATEMENT_CODE_MESSAGE(condition, statement, return_code,...)
E_MCL_ERROR_CODE time_util_convert_to_iso_8601_format(const time_t *time_value, string_t **iso8601_formatted_time)
Definitions module header file.
mcl_bool_t time_util_validate_timestamp(const char *timestamp)
#define ASSERT_CODE(condition, return_code)
void time_util_get_time(mcl_time_t *current_time)
mcl_size_t string_util_strlen(const char *buffer)
Standard library strlen wrapper.
Time utility module header file.