Skip to content

Commit

Permalink
Move iso_time to C for result_iterator_delta_modification_time
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmundell committed Nov 22, 2023
1 parent ef9105b commit e86b2da
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/manage.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 14 additions & 5 deletions src/manage_sql.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 }, \
Expand Down Expand Up @@ -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");
}

/**
Expand Down

0 comments on commit e86b2da

Please sign in to comment.