When --input-date-format is seen, don't wipe out the rest of the date
formats, simply replace the first one. Then, when --period is seen, use the first date format as the template for what to pass to the begin/end options.
This commit is contained in:
parent
4e822d213f
commit
e00c568add
1 changed files with 3 additions and 4 deletions
|
|
@ -692,7 +692,6 @@ OPT_BEGIN(date_format, "y:") {
|
||||||
OPT_BEGIN(input_date_format, ":") {
|
OPT_BEGIN(input_date_format, ":") {
|
||||||
std::strcpy(input_format, optarg);
|
std::strcpy(input_format, optarg);
|
||||||
formats[0] = input_format;
|
formats[0] = input_format;
|
||||||
formats[1] = NULL;
|
|
||||||
} OPT_END(input_date_format);
|
} OPT_END(input_date_format);
|
||||||
|
|
||||||
OPT_BEGIN(balance_format, ":") {
|
OPT_BEGIN(balance_format, ":") {
|
||||||
|
|
@ -787,14 +786,14 @@ OPT_BEGIN(period, "p:") {
|
||||||
// modify the calculation predicate (via the --begin and --end
|
// modify the calculation predicate (via the --begin and --end
|
||||||
// options) to take this into account.
|
// options) to take this into account.
|
||||||
|
|
||||||
char buf[32];
|
char buf[128];
|
||||||
interval_t interval(config.report_period);
|
interval_t interval(config.report_period);
|
||||||
if (interval.begin) {
|
if (interval.begin) {
|
||||||
std::strftime(buf, 31, "%Y/%m/%d", std::localtime(&interval.begin));
|
std::strftime(buf, 127, formats[0], std::localtime(&interval.begin));
|
||||||
process_option(config_options, "begin", buf);
|
process_option(config_options, "begin", buf);
|
||||||
}
|
}
|
||||||
if (interval.end) {
|
if (interval.end) {
|
||||||
std::strftime(buf, 31, "%Y/%m/%d", std::localtime(&interval.end));
|
std::strftime(buf, 127, formats[0], std::localtime(&interval.end));
|
||||||
process_option(config_options, "end", buf);
|
process_option(config_options, "end", buf);
|
||||||
}
|
}
|
||||||
} OPT_END(period);
|
} OPT_END(period);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue