aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2020-09-07 21:13:49 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-09-29 16:13:03 -0700
commite1c44a0a4db12ec9fa36c84b7b457d3957059b60 (patch)
tree86a86c7684f05a47321c9be5599807330b004cd1 /core
parentcccd242a363e4443f27a432f208d7296ecd9a02c (diff)
downloadsubsurface-e1c44a0a4db12ec9fa36c84b7b457d3957059b60.tar.gz
filter: save timestamps in user-readable format
So far we saved timestamps by their 64-bit value as decimal strings. Change this to a user readable format. The parsing routine still supports decimal numbers. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core')
-rw-r--r--core/filterconstraint.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/core/filterconstraint.cpp b/core/filterconstraint.cpp
index fb8b49e8c..c932b4691 100644
--- a/core/filterconstraint.cpp
+++ b/core/filterconstraint.cpp
@@ -567,8 +567,8 @@ filter_constraint::filter_constraint(const char *type_in, const char *string_mod
range_mode = filter_constraint_range_mode_from_string(range_mode_in);
if (filter_constraint_is_timestamp(type)) {
QStringList l = s.split(',');
- data.timestamp_range.from = l[0].toLongLong();
- data.timestamp_range.to = l.size() >= 2 ? l[1].toLongLong() : 0;
+ data.timestamp_range.from = parse_datetime(qPrintable(l[0]));
+ data.timestamp_range.to = l.size() >= 2 ? parse_datetime(qPrintable(l[1])) : 0;
} else if (filter_constraint_is_string(type)) {
// TODO: this obviously breaks if the strings contain ",".
// That is currently not supported by the UI, but one day we might
@@ -628,8 +628,11 @@ extern "C" char *filter_constraint_data_to_string(const filter_constraint *c)
{
QString s;
if (filter_constraint_is_timestamp(c->type)) {
- s = QString::number(c->data.timestamp_range.from) + ',' +
- QString::number(c->data.timestamp_range.to);
+ char *from_s = format_datetime(c->data.timestamp_range.from);
+ char *to_s = format_datetime(c->data.timestamp_range.to);
+ s = QString(from_s) + ',' + QString(to_s);
+ free(from_s);
+ free(to_s);
} else if (filter_constraint_is_string(c->type)) {
// TODO: this obviously breaks if the strings contain ",".
// That is currently not supported by the UI, but one day we might