diff options
Diffstat (limited to 'libmm-glib/mm-common-helpers.c')
-rw-r--r-- | libmm-glib/mm-common-helpers.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/libmm-glib/mm-common-helpers.c b/libmm-glib/mm-common-helpers.c index 085177b7..0dff0e8c 100644 --- a/libmm-glib/mm-common-helpers.c +++ b/libmm-glib/mm-common-helpers.c @@ -1752,11 +1752,18 @@ date_time_format_iso8601 (GDateTime *dt) } gchar * -mm_new_iso8601_time_from_unix_time (guint64 timestamp) +mm_new_iso8601_time_from_unix_time (guint64 timestamp, + GError **error) { g_autoptr(GDateTime) dt = NULL; dt = g_date_time_new_from_unix_utc ((gint64)timestamp); + if (!dt) { + g_set_error (error, MM_CORE_ERROR, MM_CORE_ERROR_INVALID_ARGS, + "Invalid unix time: %" G_GUINT64_FORMAT, + timestamp); + return NULL; + } return date_time_format_iso8601 (dt); } |