ManagementServer: fix some issues according to the standard

- Fix the value of Device.ManagementServer.PeriodicInformTime parameter
This commit is contained in:
Amin Ben Ramdhane 2020-03-16 17:59:59 +01:00
parent 0205794276
commit faf175823b

View file

@ -146,8 +146,8 @@ static int get_management_server_periodic_inform_time(char *refparam, struct dmc
dmuci_get_option_value_string("cwmp", "acs", "periodic_inform_time", value); dmuci_get_option_value_string("cwmp", "acs", "periodic_inform_time", value);
if ((*value)[0] != '0' && (*value)[0] != '\0') { if ((*value)[0] != '0' && (*value)[0] != '\0') {
time_value = atoi(*value); time_value = atoi(*value);
char s_now[sizeof "AAAA-MM-JJTHH:MM:SS.000Z"]; char s_now[sizeof "AAAA-MM-JJTHH:MM:SSZ"];
strftime(s_now, sizeof s_now, "%Y-%m-%dT%H:%M:%S.000Z", localtime(&time_value)); strftime(s_now, sizeof s_now, "%Y-%m-%dT%H:%M:%SZ", localtime(&time_value));
*value = dmstrdup(s_now); // MEM WILL BE FREED IN DMMEMCLEAN *value = dmstrdup(s_now); // MEM WILL BE FREED IN DMMEMCLEAN
} else { } else {
*value = "0001-01-01T00:00:00Z"; *value = "0001-01-01T00:00:00Z";
@ -166,7 +166,7 @@ static int set_management_server_periodic_inform_time(char *refparam, struct dmc
return FAULT_9007; return FAULT_9007;
return 0; return 0;
case VALUESET: case VALUESET:
strptime(value, "%Y-%m-%dT%H:%M:%S", &tm); strptime(value, "%Y-%m-%dT%H:%M:%SZ", &tm);
snprintf(buf, sizeof(buf), "%ld", mktime(&tm)); snprintf(buf, sizeof(buf), "%ld", mktime(&tm));
dmuci_set_value("cwmp", "acs", "periodic_inform_time", buf); dmuci_set_value("cwmp", "acs", "periodic_inform_time", buf);
cwmp_set_end_session(END_SESSION_RELOAD); cwmp_set_end_session(END_SESSION_RELOAD);