Update the time format according to the standard

This commit is contained in:
Amin Ben Ramdhane 2020-03-17 14:11:52 +01:00
parent 17e255c450
commit bf8737c49e

View file

@ -1541,14 +1541,9 @@ int get_shift_time_time(int shift_time, char *local_time, int size)
if (t_tm == NULL)
return -1;
if (strftime(local_time, size, "%FT%T%z", t_tm) == 0)
if (strftime(local_time, size, "%Y-%m-%dT%H:%M:%SZ", t_tm) == 0)
return -1;
local_time[25] = local_time[24];
local_time[24] = local_time[23];
local_time[22] = ':';
local_time[26] = '\0';
return 0;
}
@ -1556,7 +1551,7 @@ int get_shift_time_shift(char *local_time, char *shift)
{
struct tm tm = {0};
strptime(local_time,"%FT%T", &tm);
strptime(local_time,"%Y-%m-%dT%H:%M:%SZ", &tm);
sprintf(shift, "%u", (unsigned int)(mktime(&tm) - time(NULL)));
return 0;