From e86b2da262fdac677f6ea037abe95dc681fea085 Mon Sep 17 00:00:00 2001 From: Matt Mundell Date: Wed, 22 Nov 2023 14:27:51 +0200 Subject: [PATCH] Move iso_time to C for result_iterator_delta_modification_time --- src/manage.h | 2 +- src/manage_sql.c | 19 ++++++++++++++----- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/manage.h b/src/manage.h index 05b72b536..f0257416a 100644 --- a/src/manage.h +++ b/src/manage.h @@ -1563,7 +1563,7 @@ result_iterator_delta_qod_type (iterator_t*); gchar * result_iterator_delta_creation_time (iterator_t*); -const char * +gchar * result_iterator_delta_modification_time (iterator_t*); task_t diff --git a/src/manage_sql.c b/src/manage_sql.c index d93fe7865..9dfe2c7d9 100644 --- a/src/manage_sql.c +++ b/src/manage_sql.c @@ -22384,7 +22384,7 @@ where_qod (int min_qod) { "delta_date", \ "delta_creation_time", \ KEYWORD_TYPE_STRING }, \ - { " iso_time (delta_date, opts.user_zone)", \ + { "delta_date", \ "delta_modification_time", \ KEYWORD_TYPE_STRING }, \ { "delta_task", NULL, KEYWORD_TYPE_INTEGER }, \ @@ -23821,13 +23821,22 @@ result_iterator_delta_creation_time (iterator_t* iterator) * * @param[in] iterator Iterator. * - * @return delta modification time if any, else NULL. + * @return Time, or NULL if iteration is complete. Caller must free. */ -const char * +gchar * result_iterator_delta_modification_time (iterator_t* iterator) { - if (iterator->done) return 0; - return iterator_string (iterator, RESULT_ITERATOR_DELTA_COLUMN_OFFSET + 7); + time_t epoch; + char *iso; + + if (iterator->done) return NULL; + + epoch = iterator_int64 (iterator, RESULT_ITERATOR_DELTA_COLUMN_OFFSET + 7); + iso = iso_time (&epoch); + if (iso) + // iso points to static memory. + return g_strdup (iso); + return g_strdup("ERR"); } /**