Device.Time.CurrentLocalTime: Fix time format

- Update timezone format from '+hhmm' or '-hhmm' to '+hh:mm' or '-hh:mm'
This commit is contained in:
Amin Ben Ramdhane 2021-12-27 13:48:13 +01:00
parent dd113367d4
commit 10c5029c67

View file

@ -1022,7 +1022,7 @@ int dm_time_format(time_t ts, char **dst)
char time_buf[32] = { 0, 0 };
struct tm *t_tm;
*dst = "0001-01-01T00:00:00Z";
*dst = "0001-01-01T00:00:00+00:00";
t_tm = localtime(&ts);
if (t_tm == NULL)
@ -1031,6 +1031,11 @@ int dm_time_format(time_t ts, char **dst)
if(strftime(time_buf, sizeof(time_buf), "%Y-%m-%dT%H:%M:%S%z", t_tm) == 0)
return -1;
time_buf[25] = time_buf[24];
time_buf[24] = time_buf[23];
time_buf[22] = ':';
time_buf[26] = '\0';
*dst = dmstrdup(time_buf);
return 0;
}