[gnome-photos/wip/rishi/replace-GTimeVal-query-builder] query-builder: Use GDateTime instead of deprecated GTimeVal
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos/wip/rishi/replace-GTimeVal-query-builder] query-builder: Use GDateTime instead of deprecated GTimeVal
- Date: Tue, 25 Aug 2020 17:45:58 +0000 (UTC)
commit b2301868556bd20d0815a46e4776791c22cc430a
Author: Erich Cordoba <erich cm yandex com>
Date: Sun Jul 5 15:42:52 2020 -0500
query-builder: Use GDateTime instead of deprecated GTimeVal
Bump minimum GLib version to 2.62.0.
https://gitlab.gnome.org/GNOME/gnome-photos/-/merge_requests/136
https://gitlab.gnome.org/GNOME/gnome-photos/-/merge_requests/143
meson.build | 2 +-
src/photos-query-builder.c | 18 ++++++------------
2 files changed, 7 insertions(+), 13 deletions(-)
---
diff --git a/meson.build b/meson.build
index a0159dd6..a49309a5 100644
--- a/meson.build
+++ b/meson.build
@@ -157,7 +157,7 @@ geocode_glib_dep = dependency('geocode-glib-1.0')
gexiv_dep = dependency('gexiv2', version: '>= 0.10.8')
gio_dep = dependency('gio-2.0')
gio_unix_dep = dependency('gio-unix-2.0')
-glib_dep = dependency('glib-2.0', version: '>= 2.57.2')
+glib_dep = dependency('glib-2.0', version: '>= 2.62.0')
goa_dep = dependency('goa-1.0', version: '>= 3.8.0')
config_h.set('GOA_API_IS_SUBJECT_TO_CHANGE', true)
diff --git a/src/photos-query-builder.c b/src/photos-query-builder.c
index 2c52a130..6b996811 100644
--- a/src/photos-query-builder.c
+++ b/src/photos-query-builder.c
@@ -183,21 +183,18 @@ photos_query_builder_create_collection_query (PhotosSearchContextState *state,
const gchar *name,
const gchar *identifier_tag)
{
- GTimeVal tv;
+ g_autoptr (GDateTime) now = NULL;
PhotosQuery *query;
g_autofree gchar *identifier = NULL;
g_autofree gchar *sparql = NULL;
g_autofree gchar *time = NULL;
- gint64 timestamp;
identifier = g_strdup_printf ("%s%s",
PHOTOS_QUERY_LOCAL_COLLECTIONS_IDENTIFIER,
identifier_tag == NULL ? name : identifier_tag);
- timestamp = g_get_real_time () / G_USEC_PER_SEC;
- tv.tv_sec = timestamp;
- tv.tv_usec = 0;
- time = g_time_val_to_iso8601 (&tv);
+ now = g_date_time_new_now_utc ();
+ time = g_date_time_format_iso8601 (now);
sparql = g_strdup_printf ("INSERT { _:res a nfo:DataContainer ; a nie:DataObject ; "
"nie:contentLastModified '%s' ; "
@@ -376,16 +373,13 @@ photos_query_builder_single_query (PhotosSearchContextState *state, gint flags,
PhotosQuery *
photos_query_builder_update_mtime_query (PhotosSearchContextState *state, const gchar *resource)
{
- GTimeVal tv;
+ g_autoptr (GDateTime) now = NULL;
PhotosQuery *query;
g_autofree gchar *sparql = NULL;
g_autofree gchar *time = NULL;
- gint64 timestamp;
- timestamp = g_get_real_time () / G_USEC_PER_SEC;
- tv.tv_sec = timestamp;
- tv.tv_usec = 0;
- time = g_time_val_to_iso8601 (&tv);
+ now = g_date_time_new_now_utc ();
+ time = g_date_time_format_iso8601 (now);
sparql = g_strdup_printf ("INSERT OR REPLACE { <%s> nie:contentLastModified '%s' }", resource, time);
query = photos_query_new (state, sparql);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]