bbf: accept dateTime type with microsecond precision

Some parameters must be specified with microsecond precision such as:
 - Device.IP.Diagnostics.DownloadDiagnostics.(ROMTime, BOMTime, EOMTime, TCPOpenResponseTime, etc)
 - Device.IP.Diagnostics.UploadDiagnostics.(ROMTime, BOMTime, EOMTime, TCPOpenResponseTime, etc)
This commit is contained in:
Amin Ben Ramdhane 2020-11-28 22:31:46 +01:00
parent e3b313ef8d
commit d27c4137f7

View file

@ -1145,6 +1145,7 @@ static char *check_value_by_type(char *value, int type)
{
int i = 0, len = strlen(value);
char buf[len + 1];
struct tm tm;
strcpy(buf, value);
buf[len] = 0;
@ -1175,7 +1176,7 @@ static char *check_value_by_type(char *value, int type)
case DMT_HEXBIN:
while (buf[i] != 0) {
if (isxdigit(buf[i]) == 0)
return "0";
return "";
i++;
}
break;
@ -1187,8 +1188,8 @@ static char *check_value_by_type(char *value, int type)
}
break;
case DMT_TIME:
if (dm_validate_dateTime(buf))
return "0001-01-01T00:00:00Z";
if (!strptime(buf, (len == 27) ? "%Y-%m-%dT%H:%M:%S." : "%Y-%m-%dT%H:%M:%SZ", &tm))
return (len == 27) ? "0001-01-01T00:00:00.000000Z" : "0001-01-01T00:00:00Z";
break;
default:
break;