feat: enhanced time format verification
This commit is contained in:
parent
beb8d55337
commit
53b9743ac4
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"filetype": "csvfile",
|
"filetype": "csvfile",
|
||||||
"output_path": "./csv/",
|
"output_dir": "./csv/",
|
||||||
"databases": [
|
"databases": [
|
||||||
{
|
{
|
||||||
"dbinfo": {
|
"dbinfo": {
|
||||||
|
|
|
@ -60,6 +60,24 @@ static int csvValidateParamTsFormat(const char* csv_ts_format) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int has_Y = 0, has_m = 0, has_d = 0;
|
||||||
|
const char* p = csv_ts_format;
|
||||||
|
while (*p) {
|
||||||
|
if (*p == '%') {
|
||||||
|
p++;
|
||||||
|
switch (*p) {
|
||||||
|
case 'Y': has_Y = 1; break;
|
||||||
|
case 'm': has_m = 1; break;
|
||||||
|
case 'd': has_d = 1; break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
p++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (has_Y == 0 || has_m == 0 || has_d == 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue