mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
cccd242a36
commit
e1c44a0a4d
1 changed files with 7 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue