diff options
| author | Gyorgy Sarvari <skandigraun@gmail.com> | 2025-09-11 14:03:31 +0200 |
|---|---|---|
| committer | Khem Raj <raj.khem@gmail.com> | 2025-09-11 17:31:42 -0700 |
| commit | e1625a159eddd5225d7b18ea75c0eafb2a99cb41 (patch) | |
| tree | 5233d58ff69f2410867afd983fcd0362c72f2aa0 | |
| parent | 909985d1b95e5f05a57a0ca0e623b382fc30965a (diff) | |
| download | meta-openembedded-e1625a159eddd5225d7b18ea75c0eafb2a99cb41.tar.gz | |
libgdata: fix compiling for 32-bit targets
When compiling for 32-bit targets, compilation fails with the following error:
| ../libgdata-0.18.1/demos/calendar/calendar-cli.c:47:22: error: passing argument 1 of 'gmtime' from incompatible pointer type [-Wincompatible-pointer-types]
| 47 | tm = gmtime (&tv->tv_sec);
Upstream meanwhile has refactored the failing part in an untagged commit:
they have removed the usage of GTimeVal, since it has been deprecated.
Since it also solves the compilation issue, backport that patch.
Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
| -rw-r--r-- | meta-gnome/recipes-gnome/libgdata/libgdata/0001-Drop-usage-of-deprecated-GTimeVal.patch | 1134 | ||||
| -rw-r--r-- | meta-gnome/recipes-gnome/libgdata/libgdata_0.18.1.bb | 2 |
2 files changed, 1136 insertions, 0 deletions
diff --git a/meta-gnome/recipes-gnome/libgdata/libgdata/0001-Drop-usage-of-deprecated-GTimeVal.patch b/meta-gnome/recipes-gnome/libgdata/libgdata/0001-Drop-usage-of-deprecated-GTimeVal.patch new file mode 100644 index 0000000000..6fb52d6d52 --- /dev/null +++ b/meta-gnome/recipes-gnome/libgdata/libgdata/0001-Drop-usage-of-deprecated-GTimeVal.patch | |||
| @@ -0,0 +1,1134 @@ | |||
| 1 | From ef8722baa444958601bfddfee3a977ccf4f7c02c Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Daniel Kolesa <dkolesa@igalia.com> | ||
| 3 | Date: Tue, 16 Mar 2021 17:22:08 +0100 | ||
| 4 | Subject: [PATCH] drop usage of deprecated GTimeVal | ||
| 5 | |||
| 6 | Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/libgdata/-/commit/ef8722baa444958601bfddfee3a977ccf4f7c02c] | ||
| 7 | Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com> | ||
| 8 | |||
| 9 | --- | ||
| 10 | demos/calendar/calendar-cli.c | 90 ++++++++++++------- | ||
| 11 | demos/tasks/tasks-cli.c | 31 ++++--- | ||
| 12 | demos/youtube/youtube-cli.c | 9 +- | ||
| 13 | gdata/gdata-access-rule.c | 4 +- | ||
| 14 | gdata/gdata-batch-operation.c | 8 +- | ||
| 15 | gdata/gdata-oauth1-authorizer.c | 6 +- | ||
| 16 | gdata/gdata-parser.c | 48 +++++----- | ||
| 17 | gdata/gdata-service.c | 5 +- | ||
| 18 | .../services/calendar/gdata-calendar-event.c | 18 ++-- | ||
| 19 | .../services/calendar/gdata-calendar-query.c | 6 +- | ||
| 20 | .../contacts/gdata-contacts-contact.c | 4 +- | ||
| 21 | .../services/contacts/gdata-contacts-group.c | 4 +- | ||
| 22 | .../documents/gdata-documents-query.c | 8 +- | ||
| 23 | .../picasaweb/gdata-picasaweb-album.c | 8 +- | ||
| 24 | .../services/picasaweb/gdata-picasaweb-file.c | 8 +- | ||
| 25 | gdata/services/youtube/gdata-youtube-query.c | 18 ++-- | ||
| 26 | .../services/youtube/gdata-youtube-service.c | 10 ++- | ||
| 27 | gdata/tests/calendar.c | 60 +++++++------ | ||
| 28 | gdata/tests/contacts.c | 22 +++-- | ||
| 29 | gdata/tests/general.c | 7 +- | ||
| 30 | gdata/tests/perf.c | 15 ++-- | ||
| 31 | gdata/tests/picasaweb.c | 14 +-- | ||
| 32 | gdata/tests/youtube.c | 14 +-- | ||
| 33 | 23 files changed, 231 insertions(+), 186 deletions(-) | ||
| 34 | |||
| 35 | diff --git a/demos/calendar/calendar-cli.c b/demos/calendar/calendar-cli.c | ||
| 36 | index a1d84f67..4f601f48 100644 | ||
| 37 | --- a/demos/calendar/calendar-cli.c | ||
| 38 | +++ b/demos/calendar/calendar-cli.c | ||
| 39 | @@ -38,13 +38,13 @@ print_usage (char *argv[]) | ||
| 40 | return -1; | ||
| 41 | } | ||
| 42 | |||
| 43 | -/* Convert a GTimeVal to an ISO 8601 date string (without a time component). */ | ||
| 44 | +/* Convert a unix time to an ISO 8601 date string (without a time component). */ | ||
| 45 | static gchar * | ||
| 46 | -tv_to_iso8601_date (GTimeVal *tv) | ||
| 47 | +tv_to_iso8601_date (gint64 tv) | ||
| 48 | { | ||
| 49 | struct tm *tm; | ||
| 50 | |||
| 51 | - tm = gmtime (&tv->tv_sec); | ||
| 52 | + tm = gmtime (&tv); | ||
| 53 | |||
| 54 | return g_strdup_printf ("%04d-%02d-%02d", | ||
| 55 | tm->tm_year + 1900, | ||
| 56 | @@ -81,8 +81,9 @@ print_event (GDataCalendarEvent *event) | ||
| 57 | { | ||
| 58 | const gchar *title, *id, *description, *status, *visibility; | ||
| 59 | const gchar *transparency, *uid; | ||
| 60 | - GTimeVal date_published_tv = { 0, }; | ||
| 61 | - GTimeVal date_edited_tv = { 0, }; | ||
| 62 | + GDateTime *tmp; | ||
| 63 | + gint64 date_published_tv; | ||
| 64 | + gint64 date_edited_tv; | ||
| 65 | gchar *date_published = NULL; /* owned */ | ||
| 66 | gchar *date_edited = NULL; /* owned */ | ||
| 67 | guint sequence; | ||
| 68 | @@ -95,10 +96,14 @@ print_event (GDataCalendarEvent *event) | ||
| 69 | title = gdata_entry_get_title (GDATA_ENTRY (event)); | ||
| 70 | id = gdata_entry_get_id (GDATA_ENTRY (event)); | ||
| 71 | description = gdata_entry_get_content (GDATA_ENTRY (event)); | ||
| 72 | - date_published_tv.tv_sec = gdata_entry_get_published (GDATA_ENTRY (event)); | ||
| 73 | - date_published = g_time_val_to_iso8601 (&date_published_tv); | ||
| 74 | - date_edited_tv.tv_sec = gdata_calendar_event_get_edited (event); | ||
| 75 | - date_edited = g_time_val_to_iso8601 (&date_edited_tv); | ||
| 76 | + date_published_tv = gdata_entry_get_published (GDATA_ENTRY (event)); | ||
| 77 | + tmp = g_date_time_new_from_unix_utc (date_published_tv); | ||
| 78 | + date_published = g_date_time_format_iso8601 (tmp); | ||
| 79 | + g_date_time_unref (tmp); | ||
| 80 | + date_edited_tv = gdata_calendar_event_get_edited (event); | ||
| 81 | + tmp = g_date_time_new_from_unix_utc (date_edited_tv); | ||
| 82 | + date_edited = g_date_time_format_iso8601 (tmp); | ||
| 83 | + g_date_time_unref (tmp); | ||
| 84 | status = gdata_calendar_event_get_status (event); | ||
| 85 | visibility = gdata_calendar_event_get_visibility (event); | ||
| 86 | transparency = gdata_calendar_event_get_transparency (event); | ||
| 87 | @@ -155,20 +160,25 @@ print_event (GDataCalendarEvent *event) | ||
| 88 | |||
| 89 | for (; times != NULL; times = times->next) { | ||
| 90 | GDataGDWhen *when; | ||
| 91 | - GTimeVal start_time = { 0, }, end_time = { 0, }; | ||
| 92 | + gint64 start_time, end_time; | ||
| 93 | gchar *start = NULL, *end = NULL; /* owned */ | ||
| 94 | |||
| 95 | when = GDATA_GD_WHEN (times->data); | ||
| 96 | |||
| 97 | - start_time.tv_sec = gdata_gd_when_get_start_time (when); | ||
| 98 | - end_time.tv_sec = gdata_gd_when_get_end_time (when); | ||
| 99 | + start_time = gdata_gd_when_get_start_time (when); | ||
| 100 | + end_time = gdata_gd_when_get_end_time (when); | ||
| 101 | |||
| 102 | if (gdata_gd_when_is_date (when)) { | ||
| 103 | - start = tv_to_iso8601_date (&start_time); | ||
| 104 | - end = tv_to_iso8601_date (&end_time); | ||
| 105 | + start = tv_to_iso8601_date (start_time); | ||
| 106 | + end = tv_to_iso8601_date (end_time); | ||
| 107 | } else { | ||
| 108 | - start = g_time_val_to_iso8601 (&start_time); | ||
| 109 | - end = g_time_val_to_iso8601 (&end_time); | ||
| 110 | + GDateTime *tmp; | ||
| 111 | + tmp = g_date_time_new_from_unix_utc (start_time); | ||
| 112 | + start = g_date_time_format_iso8601 (tmp); | ||
| 113 | + g_date_time_unref (tmp); | ||
| 114 | + tmp = g_date_time_new_from_unix_utc (end_time); | ||
| 115 | + end = g_date_time_format_iso8601 (tmp); | ||
| 116 | + g_date_time_unref (tmp); | ||
| 117 | } | ||
| 118 | |||
| 119 | g_print (" • %s to %s (%s)\n", | ||
| 120 | @@ -416,8 +426,7 @@ command_insert_event (int argc, char *argv[]) | ||
| 121 | GDataAuthorizer *authorizer = NULL; | ||
| 122 | GDataGDWhen *when = NULL; | ||
| 123 | gboolean is_date; | ||
| 124 | - gchar *start_with_time = NULL, *end_with_time = NULL; | ||
| 125 | - GTimeVal start_tv = { 0, }, end_tv = { 0, }; | ||
| 126 | + GDateTime *start_tv = NULL, *end_tv = NULL; | ||
| 127 | gint i; | ||
| 128 | |||
| 129 | if (argc < 7) { | ||
| 130 | @@ -454,25 +463,38 @@ command_insert_event (int argc, char *argv[]) | ||
| 131 | event = gdata_calendar_event_new (NULL); | ||
| 132 | gdata_entry_set_title (GDATA_ENTRY (event), title); | ||
| 133 | |||
| 134 | - start_with_time = g_strconcat (start, "T00:00:00Z", NULL); | ||
| 135 | - end_with_time = g_strconcat (end, "T00:00:00Z", NULL); | ||
| 136 | - | ||
| 137 | - if (g_time_val_from_iso8601 (start, &start_tv) && | ||
| 138 | - g_time_val_from_iso8601 (end, &end_tv)) { | ||
| 139 | + start_tv = g_date_time_new_from_iso8601 (start, NULL); | ||
| 140 | + end_tv = g_date_time_new_from_iso8601 (end, NULL); | ||
| 141 | + if (start_tv && end_tv) { | ||
| 142 | /* Includes time. */ | ||
| 143 | is_date = FALSE; | ||
| 144 | - } else if (g_time_val_from_iso8601 (start_with_time, &start_tv) && | ||
| 145 | - g_time_val_from_iso8601 (end_with_time, &end_tv)) { | ||
| 146 | - /* Does not include time. */ | ||
| 147 | - is_date = TRUE; | ||
| 148 | } else { | ||
| 149 | - g_printerr ("%s: Could not parse start time ‘%s’ and end time " | ||
| 150 | - "‘%s’ as ISO 8601.\n", argv[0], start, end); | ||
| 151 | - retval = 1; | ||
| 152 | - goto done; | ||
| 153 | + gchar *start_with_time, *end_with_time; | ||
| 154 | + | ||
| 155 | + g_clear_pointer (&start_tv, g_date_time_unref); | ||
| 156 | + g_clear_pointer (&end_tv, g_date_time_unref); | ||
| 157 | + | ||
| 158 | + start_with_time = g_strconcat (start, "T00:00:00Z", NULL); | ||
| 159 | + end_with_time = g_strconcat (end, "T00:00:00Z", NULL); | ||
| 160 | + | ||
| 161 | + start_tv = g_date_time_new_from_iso8601 (start_with_time, NULL); | ||
| 162 | + end_tv = g_date_time_new_from_iso8601 (end_with_time, NULL); | ||
| 163 | + | ||
| 164 | + g_free (start_with_time); | ||
| 165 | + g_free (end_with_time); | ||
| 166 | + | ||
| 167 | + if (start_tv && end_tv) { | ||
| 168 | + /* Does not include time. */ | ||
| 169 | + is_date = TRUE; | ||
| 170 | + } else { | ||
| 171 | + g_printerr ("%s: Could not parse start time ‘%s’ and end time " | ||
| 172 | + "‘%s’ as ISO 8601.\n", argv[0], start, end); | ||
| 173 | + retval = 1; | ||
| 174 | + goto done; | ||
| 175 | + } | ||
| 176 | } | ||
| 177 | |||
| 178 | - when = gdata_gd_when_new (start_tv.tv_sec, end_tv.tv_sec, is_date); | ||
| 179 | + when = gdata_gd_when_new (g_date_time_to_unix (start_tv), g_date_time_to_unix (end_tv), is_date); | ||
| 180 | gdata_calendar_event_add_time (event, when); | ||
| 181 | g_object_unref (when); | ||
| 182 | |||
| 183 | @@ -507,8 +529,8 @@ command_insert_event (int argc, char *argv[]) | ||
| 184 | print_event (inserted_event); | ||
| 185 | |||
| 186 | done: | ||
| 187 | - g_free (start_with_time); | ||
| 188 | - g_free (end_with_time); | ||
| 189 | + g_clear_pointer (&start_tv, g_date_time_unref); | ||
| 190 | + g_clear_pointer (&end_tv, g_date_time_unref); | ||
| 191 | g_clear_object (&inserted_event); | ||
| 192 | g_clear_object (&event); | ||
| 193 | g_clear_object (&authorizer); | ||
| 194 | diff --git a/demos/tasks/tasks-cli.c b/demos/tasks/tasks-cli.c | ||
| 195 | index c795761a..ef4ae900 100644 | ||
| 196 | --- a/demos/tasks/tasks-cli.c | ||
| 197 | +++ b/demos/tasks/tasks-cli.c | ||
| 198 | @@ -67,35 +67,42 @@ print_task (GDataTasksTask *task) | ||
| 199 | { | ||
| 200 | const gchar *title, *id, *description, *parent_id, *position, *notes; | ||
| 201 | const gchar *status; | ||
| 202 | - GTimeVal date_published_tv = { 0, }; | ||
| 203 | + GDateTime *tmp; | ||
| 204 | + gint64 date_published_tv; | ||
| 205 | gchar *date_published = NULL; /* owned */ | ||
| 206 | - GTimeVal due_tv = { 0, }; | ||
| 207 | + gint64 due_tv; | ||
| 208 | gchar *due = NULL; /* owned */ | ||
| 209 | - GTimeVal completed_tv = { 0, }; | ||
| 210 | + gint64 completed_tv; | ||
| 211 | gchar *completed = NULL; /* owned */ | ||
| 212 | gboolean is_deleted, is_hidden; | ||
| 213 | |||
| 214 | title = gdata_entry_get_title (GDATA_ENTRY (task)); | ||
| 215 | id = gdata_entry_get_id (GDATA_ENTRY (task)); | ||
| 216 | description = gdata_entry_get_content (GDATA_ENTRY (task)); | ||
| 217 | - date_published_tv.tv_sec = gdata_entry_get_published (GDATA_ENTRY (task)); | ||
| 218 | - date_published = g_time_val_to_iso8601 (&date_published_tv); | ||
| 219 | + date_published_tv = gdata_entry_get_published (GDATA_ENTRY (task)); | ||
| 220 | + tmp = g_date_time_new_from_unix_utc (date_published_tv); | ||
| 221 | + date_published = g_date_time_format_iso8601 (tmp); | ||
| 222 | + g_date_time_unref (tmp); | ||
| 223 | parent_id = gdata_tasks_task_get_parent (task); | ||
| 224 | position = gdata_tasks_task_get_position (task); | ||
| 225 | notes = gdata_tasks_task_get_notes (task); | ||
| 226 | status = gdata_tasks_task_get_status (task); | ||
| 227 | - due_tv.tv_sec = gdata_tasks_task_get_due (task); | ||
| 228 | - due = g_time_val_to_iso8601 (&due_tv); | ||
| 229 | - completed_tv.tv_sec = gdata_tasks_task_get_completed (task); | ||
| 230 | - completed = g_time_val_to_iso8601 (&completed_tv); | ||
| 231 | + due_tv = gdata_tasks_task_get_due (task); | ||
| 232 | + tmp = g_date_time_new_from_unix_utc (due_tv); | ||
| 233 | + due = g_date_time_format_iso8601 (tmp); | ||
| 234 | + g_date_time_unref (tmp); | ||
| 235 | + completed_tv = gdata_tasks_task_get_completed (task); | ||
| 236 | + tmp = g_date_time_new_from_unix_utc (completed_tv); | ||
| 237 | + completed = g_date_time_format_iso8601 (tmp); | ||
| 238 | + g_date_time_unref (tmp); | ||
| 239 | is_deleted = gdata_tasks_task_is_deleted (task); | ||
| 240 | is_hidden = gdata_tasks_task_is_hidden (task); | ||
| 241 | |||
| 242 | g_print ("%s — %s\n", id, title); | ||
| 243 | - g_print (" Published: %s\n", date_published_tv.tv_sec != 0 ? date_published : "unknown"); | ||
| 244 | + g_print (" Published: %s\n", date_published_tv != 0 ? date_published : "unknown"); | ||
| 245 | g_print (" Status: %s\n", format_status (status)); | ||
| 246 | - g_print (" Due: %s\n", due_tv.tv_sec != 0 ? due : "not set"); | ||
| 247 | - g_print (" Completed: %s\n", completed_tv.tv_sec != 0 ? completed : "not yet"); | ||
| 248 | + g_print (" Due: %s\n", due_tv != 0 ? due : "not set"); | ||
| 249 | + g_print (" Completed: %s\n", completed_tv != 0 ? completed : "not yet"); | ||
| 250 | g_print (" Deleted? %s\n", is_deleted ? "Yes" : "No"); | ||
| 251 | g_print (" Hidden? %s\n", is_hidden ? "Yes" : "No"); | ||
| 252 | g_print (" Position: %s\n", position); | ||
| 253 | diff --git a/demos/youtube/youtube-cli.c b/demos/youtube/youtube-cli.c | ||
| 254 | index 37ff4afc..e3e0e3dc 100644 | ||
| 255 | --- a/demos/youtube/youtube-cli.c | ||
| 256 | +++ b/demos/youtube/youtube-cli.c | ||
| 257 | @@ -46,7 +46,8 @@ print_video (GDataYouTubeVideo *video) | ||
| 258 | { | ||
| 259 | const gchar *title, *player_uri, *id, *description; | ||
| 260 | GList/*<unowned GDataMediaThumbnail>*/ *thumbnails; | ||
| 261 | - GTimeVal date_published_tv = { 0, }; | ||
| 262 | + GDateTime *tmp; | ||
| 263 | + gint64 date_published_tv; | ||
| 264 | gchar *date_published = NULL; /* owned */ | ||
| 265 | guint duration; /* seconds */ | ||
| 266 | guint rating_min = 0, rating_max = 0, rating_count = 0; | ||
| 267 | @@ -57,8 +58,10 @@ print_video (GDataYouTubeVideo *video) | ||
| 268 | id = gdata_entry_get_id (GDATA_ENTRY (video)); | ||
| 269 | description = gdata_youtube_video_get_description (video); | ||
| 270 | thumbnails = gdata_youtube_video_get_thumbnails (video); | ||
| 271 | - date_published_tv.tv_sec = gdata_entry_get_published (GDATA_ENTRY (video)); | ||
| 272 | - date_published = g_time_val_to_iso8601 (&date_published_tv); | ||
| 273 | + date_published_tv = gdata_entry_get_published (GDATA_ENTRY (video)); | ||
| 274 | + tmp = g_date_time_new_from_unix_utc (date_published_tv); | ||
| 275 | + date_published = g_date_time_format_iso8601 (tmp); | ||
| 276 | + g_date_time_unref (tmp); | ||
| 277 | duration = gdata_youtube_video_get_duration (video); | ||
| 278 | gdata_youtube_video_get_rating (video, &rating_min, &rating_max, | ||
| 279 | &rating_count, &rating_average); | ||
| 280 | diff --git a/gdata/gdata-access-rule.c b/gdata/gdata-access-rule.c | ||
| 281 | index 9fd1ce95..0064623f 100644 | ||
| 282 | --- a/gdata/gdata-access-rule.c | ||
| 283 | +++ b/gdata/gdata-access-rule.c | ||
| 284 | @@ -257,12 +257,10 @@ gdata_access_rule_constructor (GType type, guint n_construct_params, GObjectCons | ||
| 285 | /* We can't create these in init, or they would collide with the group and control created when parsing the XML */ | ||
| 286 | if (_gdata_parsable_is_constructed_from_xml (GDATA_PARSABLE (object)) == FALSE) { | ||
| 287 | GDataAccessRulePrivate *priv = GDATA_ACCESS_RULE (object)->priv; | ||
| 288 | - GTimeVal time_val; | ||
| 289 | |||
| 290 | /* Set the edited property to the current time (creation time). We don't do this in *_init() since that would cause | ||
| 291 | * setting it from parse_xml() to fail (duplicate element). */ | ||
| 292 | - g_get_current_time (&time_val); | ||
| 293 | - priv->edited = time_val.tv_sec; | ||
| 294 | + priv->edited = g_get_real_time () / G_USEC_PER_SEC; | ||
| 295 | |||
| 296 | /* Set up the role and scope type */ | ||
| 297 | priv->role = g_strdup (GDATA_ACCESS_ROLE_NONE); | ||
| 298 | diff --git a/gdata/gdata-batch-operation.c b/gdata/gdata-batch-operation.c | ||
| 299 | index f78801ed..212fcb0b 100644 | ||
| 300 | --- a/gdata/gdata-batch-operation.c | ||
| 301 | +++ b/gdata/gdata-batch-operation.c | ||
| 302 | @@ -598,7 +598,7 @@ gdata_batch_operation_run (GDataBatchOperation *self, GCancellable *cancellable, | ||
| 303 | GDataBatchOperationPrivate *priv = self->priv; | ||
| 304 | SoupMessage *message; | ||
| 305 | GDataFeed *feed; | ||
| 306 | - GTimeVal updated; | ||
| 307 | + gint64 updated; | ||
| 308 | gchar *upload_data; | ||
| 309 | guint status; | ||
| 310 | GHashTableIter iter; | ||
| 311 | @@ -638,9 +638,9 @@ gdata_batch_operation_run (GDataBatchOperation *self, GCancellable *cancellable, | ||
| 312 | message = _gdata_service_build_message (priv->service, priv->authorization_domain, SOUP_METHOD_POST, priv->feed_uri, NULL, TRUE); | ||
| 313 | |||
| 314 | /* Build the request */ | ||
| 315 | - g_get_current_time (&updated); | ||
| 316 | + updated = g_get_real_time () / G_USEC_PER_SEC; | ||
| 317 | feed = _gdata_feed_new (GDATA_TYPE_FEED, "Batch operation feed", | ||
| 318 | - "batch1", updated.tv_sec); | ||
| 319 | + "batch1", updated); | ||
| 320 | |||
| 321 | g_hash_table_iter_init (&iter, priv->operations); | ||
| 322 | while (g_hash_table_iter_next (&iter, &op_id, (gpointer*) &op) == TRUE) { | ||
| 323 | @@ -658,7 +658,7 @@ gdata_batch_operation_run (GDataBatchOperation *self, GCancellable *cancellable, | ||
| 324 | g_free (entry_uri); | ||
| 325 | |||
| 326 | gdata_entry_set_title (entry, "Batch operation query"); | ||
| 327 | - _gdata_entry_set_updated (entry, updated.tv_sec); | ||
| 328 | + _gdata_entry_set_updated (entry, updated); | ||
| 329 | |||
| 330 | _gdata_entry_set_batch_data (entry, op->id, op->type); | ||
| 331 | _gdata_feed_add_entry (feed, entry); | ||
| 332 | diff --git a/gdata/gdata-oauth1-authorizer.c b/gdata/gdata-oauth1-authorizer.c | ||
| 333 | index 7b857ac0..6d5fd5ec 100644 | ||
| 334 | --- a/gdata/gdata-oauth1-authorizer.c | ||
| 335 | +++ b/gdata/gdata-oauth1-authorizer.c | ||
| 336 | @@ -471,7 +471,7 @@ sign_message (GDataOAuth1Authorizer *self, SoupMessage *message, const gchar *to | ||
| 337 | gchar *uri, *signature, *timestamp; | ||
| 338 | char *nonce; | ||
| 339 | gboolean is_first = TRUE; | ||
| 340 | - GTimeVal time_val; | ||
| 341 | + gint64 time_val; | ||
| 342 | guchar signature_buf[HMAC_SHA1_LEN]; | ||
| 343 | gsize signature_buf_len; | ||
| 344 | GHmac *signature_hmac; | ||
| 345 | @@ -494,8 +494,8 @@ sign_message (GDataOAuth1Authorizer *self, SoupMessage *message, const gchar *to | ||
| 346 | |||
| 347 | /* Add various standard parameters to the list (note: this modifies the hash table belonging to the caller) */ | ||
| 348 | nonce = oauth_gen_nonce (); | ||
| 349 | - g_get_current_time (&time_val); | ||
| 350 | - timestamp = g_strdup_printf ("%li", time_val.tv_sec); | ||
| 351 | + time_val = g_get_real_time () / G_USEC_PER_SEC; | ||
| 352 | + timestamp = g_strdup_printf ("%li", time_val); | ||
| 353 | |||
| 354 | if (parameters == NULL) { | ||
| 355 | parameters = g_hash_table_new (g_str_hash, g_str_equal); | ||
| 356 | diff --git a/gdata/gdata-parser.c b/gdata/gdata-parser.c | ||
| 357 | index c1cfe00d..d6ab92e2 100644 | ||
| 358 | --- a/gdata/gdata-parser.c | ||
| 359 | +++ b/gdata/gdata-parser.c | ||
| 360 | @@ -207,21 +207,22 @@ gboolean | ||
| 361 | gdata_parser_int64_from_date (const gchar *date, gint64 *_time) | ||
| 362 | { | ||
| 363 | gchar *iso8601_date; | ||
| 364 | - gboolean success; | ||
| 365 | - GTimeVal time_val; | ||
| 366 | + g_autoptr(GDateTime) time_val = NULL; | ||
| 367 | |||
| 368 | if (strlen (date) != 10 && strlen (date) != 8) | ||
| 369 | return FALSE; | ||
| 370 | |||
| 371 | /* Note: This doesn't need translating, as it's outputting an ISO 8601 time string */ | ||
| 372 | iso8601_date = g_strdup_printf ("%sT00:00:00Z", date); | ||
| 373 | - success = g_time_val_from_iso8601 (iso8601_date, &time_val); | ||
| 374 | + time_val = g_date_time_new_from_iso8601 (iso8601_date, NULL); | ||
| 375 | g_free (iso8601_date); | ||
| 376 | |||
| 377 | - if (success == TRUE) | ||
| 378 | - *_time = time_val.tv_sec; | ||
| 379 | + if (time_val) { | ||
| 380 | + *_time = g_date_time_to_unix (time_val); | ||
| 381 | + return TRUE; | ||
| 382 | + } | ||
| 383 | |||
| 384 | - return success; | ||
| 385 | + return FALSE; | ||
| 386 | } | ||
| 387 | |||
| 388 | gchar * | ||
| 389 | @@ -240,21 +241,24 @@ gdata_parser_date_from_int64 (gint64 _time) | ||
| 390 | gchar * | ||
| 391 | gdata_parser_int64_to_iso8601 (gint64 _time) | ||
| 392 | { | ||
| 393 | - GTimeVal time_val; | ||
| 394 | + g_autoptr(GDateTime) time_val = NULL; | ||
| 395 | + | ||
| 396 | + time_val = g_date_time_new_from_unix_utc (_time); | ||
| 397 | |||
| 398 | - time_val.tv_sec = _time; | ||
| 399 | - time_val.tv_usec = 0; | ||
| 400 | + if (!time_val) | ||
| 401 | + return NULL; | ||
| 402 | |||
| 403 | - return g_time_val_to_iso8601 (&time_val); | ||
| 404 | + return g_date_time_format_iso8601 (time_val); | ||
| 405 | } | ||
| 406 | |||
| 407 | gboolean | ||
| 408 | gdata_parser_int64_from_iso8601 (const gchar *date, gint64 *_time) | ||
| 409 | { | ||
| 410 | - GTimeVal time_val; | ||
| 411 | + g_autoptr(GDateTime) time_val = NULL; | ||
| 412 | |||
| 413 | - if (g_time_val_from_iso8601 (date, &time_val) == TRUE) { | ||
| 414 | - *_time = time_val.tv_sec; | ||
| 415 | + time_val = g_date_time_new_from_iso8601 (date, NULL); | ||
| 416 | + if (time_val) { | ||
| 417 | + *_time = g_date_time_to_unix (time_val); | ||
| 418 | return TRUE; | ||
| 419 | } | ||
| 420 | |||
| 421 | @@ -479,7 +483,7 @@ gdata_parser_int64_time_from_element (xmlNode *element, const gchar *element_nam | ||
| 422 | gint64 *output, gboolean *success, GError **error) | ||
| 423 | { | ||
| 424 | xmlChar *text; | ||
| 425 | - GTimeVal time_val; | ||
| 426 | + g_autoptr(GDateTime) time_val = NULL; | ||
| 427 | |||
| 428 | /* Check it's the right element */ | ||
| 429 | if (xmlStrcmp (element->name, (xmlChar*) element_name) != 0) | ||
| 430 | @@ -499,14 +503,15 @@ gdata_parser_int64_time_from_element (xmlNode *element, const gchar *element_nam | ||
| 431 | return TRUE; | ||
| 432 | } | ||
| 433 | |||
| 434 | - /* Attempt to parse the string as a GTimeVal */ | ||
| 435 | - if (g_time_val_from_iso8601 ((gchar*) text, &time_val) == FALSE) { | ||
| 436 | + /* Attempt to parse the string as a GDateTune */ | ||
| 437 | + time_val = g_date_time_new_from_iso8601 ((gchar *) text, NULL); | ||
| 438 | + if (!time_val) { | ||
| 439 | *success = gdata_parser_error_not_iso8601_format (element, (gchar*) text, error); | ||
| 440 | xmlFree (text); | ||
| 441 | return TRUE; | ||
| 442 | } | ||
| 443 | |||
| 444 | - *output = time_val.tv_sec; | ||
| 445 | + *output = g_date_time_to_unix (time_val); | ||
| 446 | |||
| 447 | /* Success! */ | ||
| 448 | xmlFree (text); | ||
| 449 | @@ -911,7 +916,7 @@ gdata_parser_int64_time_from_json_member (JsonReader *reader, const gchar *membe | ||
| 450 | gint64 *output, gboolean *success, GError **error) | ||
| 451 | { | ||
| 452 | const gchar *text; | ||
| 453 | - GTimeVal time_val; | ||
| 454 | + g_autoptr(GDateTime) time_val = NULL; | ||
| 455 | const GError *child_error = NULL; | ||
| 456 | |||
| 457 | /* Check if there's such element */ | ||
| 458 | @@ -935,14 +940,15 @@ gdata_parser_int64_time_from_json_member (JsonReader *reader, const gchar *membe | ||
| 459 | return TRUE; | ||
| 460 | } | ||
| 461 | |||
| 462 | - /* Attempt to parse the string as a GTimeVal */ | ||
| 463 | - if (g_time_val_from_iso8601 ((gchar*) text, &time_val) == FALSE) { | ||
| 464 | + /* Attempt to parse the string as a GDateTime */ | ||
| 465 | + time_val = g_date_time_new_from_iso8601 (text, NULL); | ||
| 466 | + if (!time_val) { | ||
| 467 | *success = gdata_parser_error_not_iso8601_format_json (reader, text, error); | ||
| 468 | return TRUE; | ||
| 469 | } | ||
| 470 | |||
| 471 | /* Success! */ | ||
| 472 | - *output = time_val.tv_sec; | ||
| 473 | + *output = g_date_time_to_unix (time_val); | ||
| 474 | *success = TRUE; | ||
| 475 | |||
| 476 | return TRUE; | ||
| 477 | diff --git a/gdata/gdata-service.c b/gdata/gdata-service.c | ||
| 478 | index fce970ec..40fbaf84 100644 | ||
| 479 | --- a/gdata/gdata-service.c | ||
| 480 | +++ b/gdata/gdata-service.c | ||
| 481 | @@ -956,12 +956,9 @@ __gdata_service_query (GDataService *self, GDataAuthorizationDomain *domain, con | ||
| 482 | |||
| 483 | /* Are we off the end of the final page? */ | ||
| 484 | if (query != NULL && _gdata_query_is_finished (query)) { | ||
| 485 | - GTimeVal updated; | ||
| 486 | - | ||
| 487 | /* Build an empty dummy feed to signify the end of the list. */ | ||
| 488 | - g_get_current_time (&updated); | ||
| 489 | return _gdata_feed_new (klass->feed_type, "Empty feed", "feed1", | ||
| 490 | - updated.tv_sec); | ||
| 491 | + g_get_real_time () / G_USEC_PER_SEC); | ||
| 492 | } | ||
| 493 | |||
| 494 | /* Send the request. */ | ||
| 495 | diff --git a/gdata/services/calendar/gdata-calendar-event.c b/gdata/services/calendar/gdata-calendar-event.c | ||
| 496 | index a3a4d713..4cdf2700 100644 | ||
| 497 | --- a/gdata/services/calendar/gdata-calendar-event.c | ||
| 498 | +++ b/gdata/services/calendar/gdata-calendar-event.c | ||
| 499 | @@ -37,7 +37,7 @@ | ||
| 500 | * GDataGDWhere *where; | ||
| 501 | * GDataGDWho *who; | ||
| 502 | * GDataGDWhen *when; | ||
| 503 | - * GTimeVal current_time; | ||
| 504 | + * gint64 current_time; | ||
| 505 | * GError *error = NULL; | ||
| 506 | * | ||
| 507 | * /<!-- -->* Create a service *<!-- -->/ | ||
| 508 | @@ -58,8 +58,8 @@ | ||
| 509 | * gdata_calendar_event_add_person (event, who); | ||
| 510 | * g_object_unref (who); | ||
| 511 | * | ||
| 512 | - * g_get_current_time (¤t_time); | ||
| 513 | - * when = gdata_gd_when_new (current_time.tv_sec, current_time.tv_sec + 3600, FALSE); | ||
| 514 | + * current_time = g_get_real_time () / G_USEC_PER_SEC; | ||
| 515 | + * when = gdata_gd_when_new (current_time, current_time + 3600, FALSE); | ||
| 516 | * gdata_calendar_event_add_time (event, when); | ||
| 517 | * g_object_unref (when); | ||
| 518 | * | ||
| 519 | @@ -374,12 +374,10 @@ gdata_calendar_event_constructor (GType type, guint n_construct_params, GObjectC | ||
| 520 | |||
| 521 | if (_gdata_parsable_is_constructed_from_xml (GDATA_PARSABLE (object)) == FALSE) { | ||
| 522 | GDataCalendarEventPrivate *priv = GDATA_CALENDAR_EVENT (object)->priv; | ||
| 523 | - GTimeVal time_val; | ||
| 524 | |||
| 525 | /* Set the edited property to the current time (creation time). We don't do this in *_init() since that would cause | ||
| 526 | * setting it from parse_xml() to fail (duplicate element). */ | ||
| 527 | - g_get_current_time (&time_val); | ||
| 528 | - priv->edited = time_val.tv_sec; | ||
| 529 | + priv->edited = g_get_real_time () / G_USEC_PER_SEC; | ||
| 530 | } | ||
| 531 | |||
| 532 | return object; | ||
| 533 | @@ -554,7 +552,7 @@ date_object_from_json (JsonReader *reader, | ||
| 534 | if (json_reader_read_member (reader, "dateTime")) { | ||
| 535 | const gchar *date_string; | ||
| 536 | const GError *child_error; | ||
| 537 | - GTimeVal time_val; | ||
| 538 | + GDateTime *time_val; | ||
| 539 | |||
| 540 | date_string = json_reader_get_string_value (reader); | ||
| 541 | child_error = json_reader_get_error (reader); | ||
| 542 | @@ -567,13 +565,15 @@ date_object_from_json (JsonReader *reader, | ||
| 543 | return TRUE; | ||
| 544 | } | ||
| 545 | |||
| 546 | - if (!g_time_val_from_iso8601 (date_string, &time_val)) { | ||
| 547 | + time_val = g_date_time_new_from_iso8601 (date_string, NULL); | ||
| 548 | + if (!time_val) { | ||
| 549 | *success = gdata_parser_error_not_iso8601_format_json (reader, date_string, error); | ||
| 550 | json_reader_end_member (reader); | ||
| 551 | return TRUE; | ||
| 552 | } | ||
| 553 | |||
| 554 | - date_time = time_val.tv_sec; | ||
| 555 | + date_time = g_date_time_to_unix (time_val); | ||
| 556 | + g_date_time_unref (time_val); | ||
| 557 | is_date = FALSE; | ||
| 558 | found_member = TRUE; | ||
| 559 | } | ||
| 560 | diff --git a/gdata/services/calendar/gdata-calendar-query.c b/gdata/services/calendar/gdata-calendar-query.c | ||
| 561 | index 37779bbe..dd019529 100644 | ||
| 562 | --- a/gdata/services/calendar/gdata-calendar-query.c | ||
| 563 | +++ b/gdata/services/calendar/gdata-calendar-query.c | ||
| 564 | @@ -37,7 +37,7 @@ | ||
| 565 | * GDataCalendarCalendar *calendar; | ||
| 566 | * GDataCalendarQuery *query; | ||
| 567 | * GDataFeed *feed; | ||
| 568 | - * GTimeVal current_time; | ||
| 569 | + * gint64 current_time; | ||
| 570 | * GList *i; | ||
| 571 | * GError *error = NULL; | ||
| 572 | * | ||
| 573 | @@ -47,8 +47,8 @@ | ||
| 574 | * | ||
| 575 | * /<!-- -->* Create the query to use. We're going to query for events within the next week which match the search term "party", | ||
| 576 | * * ordered by last modification time (descending). *<!-- -->/ | ||
| 577 | - * g_get_current_time (¤t_time); | ||
| 578 | - * query = gdata_calendar_query_new_with_limits ("party", current_time.tv_sec, current_time.tv_sec + 7 * 24 * 60 * 60); | ||
| 579 | + * current_time = g_get_real_time () / G_USEC_PER_SEC; | ||
| 580 | + * query = gdata_calendar_query_new_with_limits ("party", current_time, current_time + 7 * 24 * 60 * 60); | ||
| 581 | * gdata_calendar_query_set_order_by (query, "lastmodified"); | ||
| 582 | * | ||
| 583 | * /<!-- -->* Execute the query *<!-- -->/ | ||
| 584 | diff --git a/gdata/services/contacts/gdata-contacts-contact.c b/gdata/services/contacts/gdata-contacts-contact.c | ||
| 585 | index 4f511315..eb4148d0 100644 | ||
| 586 | --- a/gdata/services/contacts/gdata-contacts-contact.c | ||
| 587 | +++ b/gdata/services/contacts/gdata-contacts-contact.c | ||
| 588 | @@ -582,12 +582,10 @@ gdata_contacts_contact_constructor (GType type, guint n_construct_params, GObjec | ||
| 589 | |||
| 590 | if (_gdata_parsable_is_constructed_from_xml (GDATA_PARSABLE (object)) == FALSE) { | ||
| 591 | GDataContactsContactPrivate *priv = GDATA_CONTACTS_CONTACT (object)->priv; | ||
| 592 | - GTimeVal time_val; | ||
| 593 | |||
| 594 | /* Set the edited property to the current time (creation time). We don't do this in *_init() since that would cause | ||
| 595 | * setting it from parse_xml() to fail (duplicate element). */ | ||
| 596 | - g_get_current_time (&time_val); | ||
| 597 | - priv->edited = time_val.tv_sec; | ||
| 598 | + priv->edited = g_get_real_time () / G_USEC_PER_SEC; | ||
| 599 | } | ||
| 600 | |||
| 601 | return object; | ||
| 602 | diff --git a/gdata/services/contacts/gdata-contacts-group.c b/gdata/services/contacts/gdata-contacts-group.c | ||
| 603 | index 055f4255..2059369a 100644 | ||
| 604 | --- a/gdata/services/contacts/gdata-contacts-group.c | ||
| 605 | +++ b/gdata/services/contacts/gdata-contacts-group.c | ||
| 606 | @@ -266,12 +266,10 @@ gdata_contacts_group_constructor (GType type, guint n_construct_params, GObjectC | ||
| 607 | |||
| 608 | if (_gdata_parsable_is_constructed_from_xml (GDATA_PARSABLE (object)) == FALSE) { | ||
| 609 | GDataContactsGroupPrivate *priv = GDATA_CONTACTS_GROUP (object)->priv; | ||
| 610 | - GTimeVal time_val; | ||
| 611 | |||
| 612 | /* Set the edited property to the current time (creation time). We don't do this in *_init() since that would cause setting it from | ||
| 613 | * parse_xml() to fail (duplicate element). */ | ||
| 614 | - g_get_current_time (&time_val); | ||
| 615 | - priv->edited = time_val.tv_sec; | ||
| 616 | + priv->edited = g_get_real_time () / G_USEC_PER_SEC; | ||
| 617 | } | ||
| 618 | |||
| 619 | return object; | ||
| 620 | diff --git a/gdata/services/documents/gdata-documents-query.c b/gdata/services/documents/gdata-documents-query.c | ||
| 621 | index e589b524..4797718f 100644 | ||
| 622 | --- a/gdata/services/documents/gdata-documents-query.c | ||
| 623 | +++ b/gdata/services/documents/gdata-documents-query.c | ||
| 624 | @@ -37,7 +37,7 @@ | ||
| 625 | * GDataDocumentsService *service; | ||
| 626 | * GDataDocumentsQuery *query; | ||
| 627 | * GDataFeed *feed; | ||
| 628 | - * GTimeVal current_time; | ||
| 629 | + * gint64 current_time; | ||
| 630 | * GList *i; | ||
| 631 | * GError *error = NULL; | ||
| 632 | * | ||
| 633 | @@ -51,9 +51,9 @@ | ||
| 634 | * gdata_documents_query_add_collaborator (query, "example@gmail.com"); | ||
| 635 | * gdata_documents_query_set_show_deleted (query, TRUE); | ||
| 636 | * | ||
| 637 | - * g_get_current_time (¤t_time); | ||
| 638 | - * gdata_query_set_updated_min (GDATA_QUERY (query), current_time.tv_sec - 7 * 24 * 60 * 60); | ||
| 639 | - * gdata_query_set_updated_max (GDATA_QUERY (query), current_time.tv_sec); | ||
| 640 | + * current_time = g_get_real_time () / G_USEC_PER_SEC; | ||
| 641 | + * gdata_query_set_updated_min (GDATA_QUERY (query), current_time - 7 * 24 * 60 * 60); | ||
| 642 | + * gdata_query_set_updated_max (GDATA_QUERY (query), current_time); | ||
| 643 | * | ||
| 644 | * /<!-- -->* Execute the query *<!-- -->/ | ||
| 645 | * feed = gdata_documents_service_query_documents (service, query, NULL, NULL, NULL, &error); | ||
| 646 | diff --git a/gdata/services/picasaweb/gdata-picasaweb-album.c b/gdata/services/picasaweb/gdata-picasaweb-album.c | ||
| 647 | index 40fd8cfb..fd6d0abc 100644 | ||
| 648 | --- a/gdata/services/picasaweb/gdata-picasaweb-album.c | ||
| 649 | +++ b/gdata/services/picasaweb/gdata-picasaweb-album.c | ||
| 650 | @@ -507,13 +507,13 @@ gdata_picasaweb_album_constructor (GType type, guint n_construct_params, GObject | ||
| 651 | |||
| 652 | if (_gdata_parsable_is_constructed_from_xml (GDATA_PARSABLE (object)) == FALSE) { | ||
| 653 | GDataPicasaWebAlbumPrivate *priv = GDATA_PICASAWEB_ALBUM (object)->priv; | ||
| 654 | - GTimeVal time_val; | ||
| 655 | + gint64 time_val; | ||
| 656 | |||
| 657 | /* Set the edited and timestamp properties to the current time (creation time). bgo#599140 | ||
| 658 | * We don't do this in *_init() since that would cause setting it from parse_xml() to fail (duplicate element). */ | ||
| 659 | - g_get_current_time (&time_val); | ||
| 660 | - priv->timestamp = (gint64) time_val.tv_sec * 1000; | ||
| 661 | - priv->edited = time_val.tv_sec; | ||
| 662 | + time_val = g_get_real_time () / G_USEC_PER_SEC; | ||
| 663 | + priv->timestamp = time_val * 1000; | ||
| 664 | + priv->edited = time_val; | ||
| 665 | } | ||
| 666 | |||
| 667 | return object; | ||
| 668 | diff --git a/gdata/services/picasaweb/gdata-picasaweb-file.c b/gdata/services/picasaweb/gdata-picasaweb-file.c | ||
| 669 | index 53aab33b..96db23a6 100644 | ||
| 670 | --- a/gdata/services/picasaweb/gdata-picasaweb-file.c | ||
| 671 | +++ b/gdata/services/picasaweb/gdata-picasaweb-file.c | ||
| 672 | @@ -690,13 +690,13 @@ gdata_picasaweb_file_constructor (GType type, guint n_construct_params, GObjectC | ||
| 673 | |||
| 674 | if (_gdata_parsable_is_constructed_from_xml (GDATA_PARSABLE (object)) == FALSE) { | ||
| 675 | GDataPicasaWebFilePrivate *priv = GDATA_PICASAWEB_FILE (object)->priv; | ||
| 676 | - GTimeVal time_val; | ||
| 677 | + gint64 time_val; | ||
| 678 | |||
| 679 | /* Set the edited and timestamp properties to the current time (creation time). bgo#599140 | ||
| 680 | * We don't do this in *_init() since that would cause setting it from parse_xml() to fail (duplicate element). */ | ||
| 681 | - g_get_current_time (&time_val); | ||
| 682 | - priv->timestamp = (gint64) time_val.tv_sec * 1000; | ||
| 683 | - priv->edited = time_val.tv_sec; | ||
| 684 | + time_val = g_get_real_time () / G_USEC_PER_SEC; | ||
| 685 | + priv->timestamp = time_val * 1000; | ||
| 686 | + priv->edited = time_val; | ||
| 687 | } | ||
| 688 | |||
| 689 | return object; | ||
| 690 | diff --git a/gdata/services/youtube/gdata-youtube-query.c b/gdata/services/youtube/gdata-youtube-query.c | ||
| 691 | index 212a0d10..bb5cff15 100644 | ||
| 692 | --- a/gdata/services/youtube/gdata-youtube-query.c | ||
| 693 | +++ b/gdata/services/youtube/gdata-youtube-query.c | ||
| 694 | @@ -572,22 +572,20 @@ get_query_uri (GDataQuery *self, const gchar *feed_uri, GString *query_uri, gboo | ||
| 695 | |||
| 696 | if (priv->age != GDATA_YOUTUBE_AGE_ALL_TIME) { | ||
| 697 | gchar *after; | ||
| 698 | - GTimeVal tv = { 0, }; | ||
| 699 | + GDateTime *tv, *tv2; | ||
| 700 | |||
| 701 | - g_get_current_time (&tv); | ||
| 702 | - | ||
| 703 | - /* Squash the microseconds; they’re not useful. */ | ||
| 704 | - tv.tv_usec = 0; | ||
| 705 | + /* don't use g_date_time_new_now_utc (squash microseconds) */ | ||
| 706 | + tv2 = g_date_time_new_from_unix_utc (g_get_real_time () / G_USEC_PER_SEC); | ||
| 707 | |||
| 708 | switch (priv->age) { | ||
| 709 | case GDATA_YOUTUBE_AGE_TODAY: | ||
| 710 | - tv.tv_sec -= 24 * 60 * 60; | ||
| 711 | + tv = g_date_time_add_days (tv2, -1); | ||
| 712 | break; | ||
| 713 | case GDATA_YOUTUBE_AGE_THIS_WEEK: | ||
| 714 | - tv.tv_sec -= 7 * 24 * 60 * 60; | ||
| 715 | + tv = g_date_time_add_weeks (tv2, -1); | ||
| 716 | break; | ||
| 717 | case GDATA_YOUTUBE_AGE_THIS_MONTH: | ||
| 718 | - tv.tv_sec -= 31 * 24 * 60 * 60; | ||
| 719 | + tv = g_date_time_add_months (tv2, -1); | ||
| 720 | break; | ||
| 721 | case GDATA_YOUTUBE_AGE_ALL_TIME: | ||
| 722 | default: | ||
| 723 | @@ -596,9 +594,11 @@ get_query_uri (GDataQuery *self, const gchar *feed_uri, GString *query_uri, gboo | ||
| 724 | |||
| 725 | APPEND_SEP | ||
| 726 | |||
| 727 | - after = g_time_val_to_iso8601 (&tv); | ||
| 728 | + after = g_date_time_format_iso8601 (tv); | ||
| 729 | g_string_append_printf (query_uri, "publishedAfter=%s", after); | ||
| 730 | g_free (after); | ||
| 731 | + g_date_time_unref (tv); | ||
| 732 | + g_date_time_unref (tv2); | ||
| 733 | } | ||
| 734 | |||
| 735 | /* We don’t need to use APPEND_SEP below here, as this parameter is | ||
| 736 | diff --git a/gdata/services/youtube/gdata-youtube-service.c b/gdata/services/youtube/gdata-youtube-service.c | ||
| 737 | index 75134e57..35994c54 100644 | ||
| 738 | --- a/gdata/services/youtube/gdata-youtube-service.c | ||
| 739 | +++ b/gdata/services/youtube/gdata-youtube-service.c | ||
| 740 | @@ -684,14 +684,16 @@ standard_feed_type_to_feed_uri (GDataYouTubeStandardFeedType feed_type) | ||
| 741 | case GDATA_YOUTUBE_RECENTLY_FEATURED_FEED: | ||
| 742 | case GDATA_YOUTUBE_WATCH_ON_MOBILE_FEED: { | ||
| 743 | gchar *date, *out; | ||
| 744 | - GTimeVal tv; | ||
| 745 | + GDateTime *tv, *tv2; | ||
| 746 | |||
| 747 | /* All feed types except MOST_POPULAR have been deprecated for | ||
| 748 | * a while, and fall back to MOST_POPULAR on the server anyway. | ||
| 749 | * See: https://developers.google.com/youtube/2.0/developers_guide_protocol_video_feeds#Standard_feeds */ | ||
| 750 | - g_get_current_time (&tv); | ||
| 751 | - tv.tv_sec -= 24 * 60 * 60; /* 1 day ago */ | ||
| 752 | - date = g_time_val_to_iso8601 (&tv); | ||
| 753 | + tv = g_date_time_new_now_utc (); | ||
| 754 | + tv2 = g_date_time_add_days (tv, -1); | ||
| 755 | + g_date_time_unref (tv); | ||
| 756 | + date = g_date_time_format_iso8601 (tv2); | ||
| 757 | + g_date_time_unref (tv2); | ||
| 758 | out = _gdata_service_build_uri ("https://www.googleapis.com/youtube/v3/videos" | ||
| 759 | "?part=snippet" | ||
| 760 | "&chart=mostPopular" | ||
| 761 | diff --git a/gdata/tests/calendar.c b/gdata/tests/calendar.c | ||
| 762 | index 4d70d1b7..87fb0b81 100644 | ||
| 763 | --- a/gdata/tests/calendar.c | ||
| 764 | +++ b/gdata/tests/calendar.c | ||
| 765 | @@ -495,7 +495,7 @@ test_event_insert (InsertEventData *data, gconstpointer service) | ||
| 766 | GDataGDWhere *where; | ||
| 767 | GDataGDWho *who; | ||
| 768 | GDataGDWhen *when; | ||
| 769 | - GTimeVal start_time, end_time; | ||
| 770 | + GDateTime *start_time, *end_time; | ||
| 771 | GError *error = NULL; | ||
| 772 | |||
| 773 | gdata_test_mock_server_start_trace (mock_server, "event-insert"); | ||
| 774 | @@ -512,11 +512,13 @@ test_event_insert (InsertEventData *data, gconstpointer service) | ||
| 775 | who = gdata_gd_who_new (GDATA_GD_WHO_EVENT_ORGANIZER, "John Smith‽", "john.smith@example.com"); | ||
| 776 | gdata_calendar_event_add_person (event, who); | ||
| 777 | g_object_unref (who); | ||
| 778 | - g_time_val_from_iso8601 ("2009-04-17T15:00:00.000Z", &start_time); | ||
| 779 | - g_time_val_from_iso8601 ("2009-04-17T17:00:00.000Z", &end_time); | ||
| 780 | - when = gdata_gd_when_new (start_time.tv_sec, end_time.tv_sec, FALSE); | ||
| 781 | + start_time = g_date_time_new_from_iso8601 ("2009-04-17T15:00:00.000Z", NULL); | ||
| 782 | + end_time = g_date_time_new_from_iso8601 ("2009-04-17T17:00:00.000Z", NULL); | ||
| 783 | + when = gdata_gd_when_new (g_date_time_to_unix (start_time), g_date_time_to_unix (end_time), FALSE); | ||
| 784 | gdata_calendar_event_add_time (event, when); | ||
| 785 | g_object_unref (when); | ||
| 786 | + g_date_time_unref (start_time); | ||
| 787 | + g_date_time_unref (end_time); | ||
| 788 | |||
| 789 | /* Insert the event */ | ||
| 790 | new_event = data->new_event = gdata_calendar_service_insert_calendar_event (GDATA_CALENDAR_SERVICE (service), | ||
| 791 | @@ -540,8 +542,8 @@ G_STMT_START { | ||
| 792 | GDataGDWhere *where; | ||
| 793 | GDataGDWho *who; | ||
| 794 | GDataGDWhen *when; | ||
| 795 | - GTimeVal start_time; | ||
| 796 | - GTimeVal end_time; | ||
| 797 | + GDateTime *start_time; | ||
| 798 | + GDateTime *end_time; | ||
| 799 | |||
| 800 | event = gdata_calendar_event_new (NULL); | ||
| 801 | |||
| 802 | @@ -555,11 +557,13 @@ G_STMT_START { | ||
| 803 | who = gdata_gd_who_new (GDATA_GD_WHO_EVENT_ORGANIZER, "John Smith‽", "john.smith@example.com"); | ||
| 804 | gdata_calendar_event_add_person (event, who); | ||
| 805 | g_object_unref (who); | ||
| 806 | - g_time_val_from_iso8601 ("2009-04-17T15:00:00.000Z", &start_time); | ||
| 807 | - g_time_val_from_iso8601 ("2009-04-17T17:00:00.000Z", &end_time); | ||
| 808 | - when = gdata_gd_when_new (start_time.tv_sec, end_time.tv_sec, FALSE); | ||
| 809 | + start_time = g_date_time_new_from_iso8601 ("2009-04-17T15:00:00.000Z", NULL); | ||
| 810 | + end_time = g_date_time_new_from_iso8601 ("2009-04-17T17:00:00.000Z", NULL); | ||
| 811 | + when = gdata_gd_when_new (g_date_time_to_unix (start_time), g_date_time_to_unix (end_time), FALSE); | ||
| 812 | gdata_calendar_event_add_time (event, when); | ||
| 813 | g_object_unref (when); | ||
| 814 | + g_date_time_unref (start_time); | ||
| 815 | + g_date_time_unref (end_time); | ||
| 816 | |||
| 817 | /* Insert the event */ | ||
| 818 | gdata_calendar_service_insert_calendar_event_async (GDATA_CALENDAR_SERVICE (service), | ||
| 819 | @@ -587,7 +591,7 @@ test_event_json (void) | ||
| 820 | GDataGDWhere *where; | ||
| 821 | GDataGDWho *who; | ||
| 822 | GDataGDWhen *when; | ||
| 823 | - GTimeVal start_time, end_time; | ||
| 824 | + GDateTime *start_time, *end_time; | ||
| 825 | |||
| 826 | event = gdata_calendar_event_new (NULL); | ||
| 827 | |||
| 828 | @@ -601,11 +605,13 @@ test_event_json (void) | ||
| 829 | who = gdata_gd_who_new (GDATA_GD_WHO_EVENT_ORGANIZER, "John Smith‽", "john.smith@example.com"); | ||
| 830 | gdata_calendar_event_add_person (event, who); | ||
| 831 | g_object_unref (who); | ||
| 832 | - g_time_val_from_iso8601 ("2009-04-17T15:00:00.000Z", &start_time); | ||
| 833 | - g_time_val_from_iso8601 ("2009-04-17T17:00:00.000Z", &end_time); | ||
| 834 | - when = gdata_gd_when_new (start_time.tv_sec, end_time.tv_sec, FALSE); | ||
| 835 | + start_time = g_date_time_new_from_iso8601 ("2009-04-17T15:00:00.000Z", NULL); | ||
| 836 | + end_time = g_date_time_new_from_iso8601 ("2009-04-17T17:00:00.000Z", NULL); | ||
| 837 | + when = gdata_gd_when_new (g_date_time_to_unix (start_time), g_date_time_to_unix (end_time), FALSE); | ||
| 838 | gdata_calendar_event_add_time (event, when); | ||
| 839 | g_object_unref (when); | ||
| 840 | + g_date_time_unref (start_time); | ||
| 841 | + g_date_time_unref (end_time); | ||
| 842 | |||
| 843 | /* Check the JSON */ | ||
| 844 | gdata_test_assert_json (event, "{" | ||
| 845 | @@ -1099,7 +1105,7 @@ static void | ||
| 846 | test_query_uri (void) | ||
| 847 | { | ||
| 848 | gint64 _time; | ||
| 849 | - GTimeVal time_val; | ||
| 850 | + GDateTime *time_val; | ||
| 851 | gchar *query_uri; | ||
| 852 | GDataCalendarQuery *query = gdata_calendar_query_new ("q"); | ||
| 853 | |||
| 854 | @@ -1111,15 +1117,15 @@ test_query_uri (void) | ||
| 855 | g_assert_cmpstr (gdata_calendar_query_get_order_by (query), ==, "starttime"); | ||
| 856 | |||
| 857 | G_GNUC_BEGIN_IGNORE_DEPRECATIONS | ||
| 858 | - g_time_val_from_iso8601 ("2009-04-17T15:00:00.000Z", &time_val); | ||
| 859 | - gdata_calendar_query_set_recurrence_expansion_start (query, time_val.tv_sec); | ||
| 860 | + time_val = g_date_time_new_from_iso8601 ("2009-04-17T15:00:00.000Z", NULL); | ||
| 861 | + gdata_calendar_query_set_recurrence_expansion_start (query, g_date_time_to_unix (time_val)); | ||
| 862 | _time = gdata_calendar_query_get_recurrence_expansion_start (query); | ||
| 863 | - g_assert_cmpint (_time, ==, time_val.tv_sec); | ||
| 864 | + g_assert_cmpint (_time, ==, g_date_time_to_unix (time_val)); | ||
| 865 | |||
| 866 | - g_time_val_from_iso8601 ("2010-04-17T15:00:00.000Z", &time_val); | ||
| 867 | - gdata_calendar_query_set_recurrence_expansion_end (query, time_val.tv_sec); | ||
| 868 | + time_val = g_date_time_new_from_iso8601 ("2010-04-17T15:00:00.000Z", NULL); | ||
| 869 | + gdata_calendar_query_set_recurrence_expansion_end (query, g_date_time_to_unix (time_val)); | ||
| 870 | _time = gdata_calendar_query_get_recurrence_expansion_end (query); | ||
| 871 | - g_assert_cmpint (_time, ==, time_val.tv_sec); | ||
| 872 | + g_assert_cmpint (_time, ==, g_date_time_to_unix (time_val)); | ||
| 873 | G_GNUC_END_IGNORE_DEPRECATIONS | ||
| 874 | |||
| 875 | gdata_calendar_query_set_single_events (query, TRUE); | ||
| 876 | @@ -1130,15 +1136,17 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS | ||
| 877 | g_assert_cmpstr (gdata_calendar_query_get_sort_order (query), ==, "descending"); | ||
| 878 | G_GNUC_END_IGNORE_DEPRECATIONS | ||
| 879 | |||
| 880 | - g_time_val_from_iso8601 ("2009-04-17T15:00:00.000Z", &time_val); | ||
| 881 | - gdata_calendar_query_set_start_min (query, time_val.tv_sec); | ||
| 882 | + time_val = g_date_time_new_from_iso8601 ("2009-04-17T15:00:00.000Z", NULL); | ||
| 883 | + gdata_calendar_query_set_start_min (query, g_date_time_to_unix (time_val)); | ||
| 884 | _time = gdata_calendar_query_get_start_min (query); | ||
| 885 | - g_assert_cmpint (_time, ==, time_val.tv_sec); | ||
| 886 | + g_assert_cmpint (_time, ==, g_date_time_to_unix (time_val)); | ||
| 887 | + g_date_time_unref (time_val); | ||
| 888 | |||
| 889 | - g_time_val_from_iso8601 ("2010-04-17T15:00:00.000Z", &time_val); | ||
| 890 | - gdata_calendar_query_set_start_max (query, time_val.tv_sec); | ||
| 891 | + time_val = g_date_time_new_from_iso8601 ("2010-04-17T15:00:00.000Z", NULL); | ||
| 892 | + gdata_calendar_query_set_start_max (query, g_date_time_to_unix (time_val)); | ||
| 893 | _time = gdata_calendar_query_get_start_max (query); | ||
| 894 | - g_assert_cmpint (_time, ==, time_val.tv_sec); | ||
| 895 | + g_assert_cmpint (_time, ==, g_date_time_to_unix (time_val)); | ||
| 896 | + g_date_time_unref (time_val); | ||
| 897 | |||
| 898 | gdata_calendar_query_set_timezone (query, "America/Los Angeles"); | ||
| 899 | g_assert_cmpstr (gdata_calendar_query_get_timezone (query), ==, "America/Los_Angeles"); | ||
| 900 | diff --git a/gdata/tests/contacts.c b/gdata/tests/contacts.c | ||
| 901 | index e4f72deb..f70cee25 100644 | ||
| 902 | --- a/gdata/tests/contacts.c | ||
| 903 | +++ b/gdata/tests/contacts.c | ||
| 904 | @@ -304,14 +304,12 @@ test_contact_insert (InsertData *data, gconstpointer service) | ||
| 905 | GList *list; | ||
| 906 | GDate date; | ||
| 907 | GHashTable *properties; | ||
| 908 | - GTimeVal current_time; | ||
| 909 | gint64 edited, creation_time; | ||
| 910 | GError *error = NULL; | ||
| 911 | |||
| 912 | gdata_test_mock_server_start_trace (mock_server, "contact-insert"); | ||
| 913 | |||
| 914 | contact = gdata_contacts_contact_new (NULL); | ||
| 915 | - g_get_current_time (¤t_time); | ||
| 916 | |||
| 917 | /* Check the kind is present and correct */ | ||
| 918 | g_assert (GDATA_IS_CONTACTS_CONTACT (contact)); | ||
| 919 | @@ -752,13 +750,13 @@ static void | ||
| 920 | test_group_insert (InsertGroupData *data, gconstpointer service) | ||
| 921 | { | ||
| 922 | GDataContactsGroup *group, *new_group; | ||
| 923 | - GTimeVal time_val; | ||
| 924 | + gint64 time_val; | ||
| 925 | GHashTable *properties; | ||
| 926 | GError *error = NULL; | ||
| 927 | |||
| 928 | gdata_test_mock_server_start_trace (mock_server, "group-insert"); | ||
| 929 | |||
| 930 | - g_get_current_time (&time_val); | ||
| 931 | + time_val = g_get_real_time () / G_USEC_PER_SEC; | ||
| 932 | |||
| 933 | group = gdata_contacts_group_new (NULL); | ||
| 934 | |||
| 935 | @@ -780,7 +778,7 @@ test_group_insert (InsertGroupData *data, gconstpointer service) | ||
| 936 | /* Check the properties. Time-based properties can't be checked when running against a mock server, since | ||
| 937 | * the trace files may be quite old. */ | ||
| 938 | if (uhm_server_get_enable_online (mock_server) == TRUE) { | ||
| 939 | - g_assert_cmpint (gdata_contacts_group_get_edited (new_group), >=, time_val.tv_sec); | ||
| 940 | + g_assert_cmpint (gdata_contacts_group_get_edited (new_group), >=, time_val); | ||
| 941 | } | ||
| 942 | g_assert (gdata_contacts_group_is_deleted (new_group) == FALSE); | ||
| 943 | g_assert (gdata_contacts_group_get_system_group_id (new_group) == NULL); | ||
| 944 | @@ -850,12 +848,12 @@ test_contact_properties (void) | ||
| 945 | gchar *nickname, *file_as, *billing_information, *directory_server, *gender, *initials, *maiden_name, *mileage, *occupation; | ||
| 946 | gchar *priority, *sensitivity, *short_name, *subject, *photo_etag; | ||
| 947 | GDate date, *date2; | ||
| 948 | - GTimeVal current_time; | ||
| 949 | + gint64 current_time; | ||
| 950 | gint64 edited; | ||
| 951 | gboolean deleted, birthday_has_year; | ||
| 952 | |||
| 953 | contact = gdata_contacts_contact_new (NULL); | ||
| 954 | - g_get_current_time (¤t_time); | ||
| 955 | + current_time = g_get_real_time () / G_USEC_PER_SEC; | ||
| 956 | |||
| 957 | /* Check the kind is present and correct */ | ||
| 958 | g_assert (GDATA_IS_CONTACTS_CONTACT (contact)); | ||
| 959 | @@ -984,7 +982,7 @@ test_contact_properties (void) | ||
| 960 | "subject", &subject, | ||
| 961 | NULL); | ||
| 962 | |||
| 963 | - g_assert_cmpint (edited, ==, current_time.tv_sec); | ||
| 964 | + g_assert_cmpint (edited, ==, current_time); | ||
| 965 | g_assert (deleted == FALSE); | ||
| 966 | g_assert (photo_etag == NULL); | ||
| 967 | g_assert (name2 == name); | ||
| 968 | @@ -1751,7 +1749,7 @@ static void | ||
| 969 | test_group_properties (void) | ||
| 970 | { | ||
| 971 | GDataContactsGroup *group; | ||
| 972 | - GTimeVal time_val; | ||
| 973 | + gint64 time_val; | ||
| 974 | GHashTable *properties; | ||
| 975 | gint64 edited; | ||
| 976 | gboolean deleted; | ||
| 977 | @@ -1768,8 +1766,8 @@ test_group_properties (void) | ||
| 978 | g_assert (gdata_contacts_group_set_extended_property (group, "foobar", "barfoo") == TRUE); | ||
| 979 | |||
| 980 | /* Check various properties */ | ||
| 981 | - g_get_current_time (&time_val); | ||
| 982 | - g_assert_cmpint (gdata_contacts_group_get_edited (group), ==, time_val.tv_sec); | ||
| 983 | + time_val = g_get_real_time () / G_USEC_PER_SEC; | ||
| 984 | + g_assert_cmpint (gdata_contacts_group_get_edited (group), ==, time_val); | ||
| 985 | g_assert (gdata_contacts_group_is_deleted (group) == FALSE); | ||
| 986 | g_assert (gdata_contacts_group_get_system_group_id (group) == NULL); | ||
| 987 | |||
| 988 | @@ -1785,7 +1783,7 @@ test_group_properties (void) | ||
| 989 | "system-group-id", &system_group_id, | ||
| 990 | NULL); | ||
| 991 | |||
| 992 | - g_assert_cmpint (edited, ==, time_val.tv_sec); | ||
| 993 | + g_assert_cmpint (edited, ==, time_val); | ||
| 994 | g_assert (deleted == FALSE); | ||
| 995 | g_assert (system_group_id == NULL); | ||
| 996 | |||
| 997 | diff --git a/gdata/tests/general.c b/gdata/tests/general.c | ||
| 998 | index 30604ba1..39478713 100644 | ||
| 999 | --- a/gdata/tests/general.c | ||
| 1000 | +++ b/gdata/tests/general.c | ||
| 1001 | @@ -3502,11 +3502,12 @@ static void | ||
| 1002 | test_gd_when_escaping (void) | ||
| 1003 | { | ||
| 1004 | GDataGDWhen *when; | ||
| 1005 | - GTimeVal start_time; | ||
| 1006 | + GDateTime *start_time; | ||
| 1007 | |||
| 1008 | - g_time_val_from_iso8601 ("2005-06-07T01:00:00Z", &start_time); | ||
| 1009 | - when = gdata_gd_when_new (start_time.tv_sec, -1, FALSE); | ||
| 1010 | + start_time = g_date_time_new_from_iso8601 ("2005-06-07T01:00:00Z", NULL); | ||
| 1011 | + when = gdata_gd_when_new (g_date_time_to_unix (start_time), -1, FALSE); | ||
| 1012 | gdata_gd_when_set_value_string (when, "Value string & stuff!"); | ||
| 1013 | + g_date_time_unref (start_time); | ||
| 1014 | |||
| 1015 | /* Check the outputted XML is escaped properly */ | ||
| 1016 | gdata_test_assert_xml (when, | ||
| 1017 | diff --git a/gdata/tests/perf.c b/gdata/tests/perf.c | ||
| 1018 | index 2749d40d..60f3dcc1 100644 | ||
| 1019 | --- a/gdata/tests/perf.c | ||
| 1020 | +++ b/gdata/tests/perf.c | ||
| 1021 | @@ -78,23 +78,24 @@ test_parse_feed (void) | ||
| 1022 | static void | ||
| 1023 | test_perf_parsing (void) | ||
| 1024 | { | ||
| 1025 | - GTimeVal start_time, end_time; | ||
| 1026 | + GDateTime *start_time, *end_time; | ||
| 1027 | + GTimeSpan total_time, per_iteration_time; | ||
| 1028 | guint i; | ||
| 1029 | - guint64 total_time; /* microseconds */ | ||
| 1030 | - guint64 per_iteration_time; /* microseconds */ | ||
| 1031 | |||
| 1032 | #define ITERATIONS 10000 | ||
| 1033 | |||
| 1034 | /* Test feed parsing time */ | ||
| 1035 | - g_get_current_time (&start_time); | ||
| 1036 | + start_time = g_date_time_new_now_utc (); | ||
| 1037 | for (i = 0; i < ITERATIONS; i++) | ||
| 1038 | test_parse_feed (); | ||
| 1039 | - g_get_current_time (&end_time); | ||
| 1040 | + end_time = g_date_time_new_now_utc (); | ||
| 1041 | |||
| 1042 | - total_time = (end_time.tv_sec - start_time.tv_sec) * G_USEC_PER_SEC + | ||
| 1043 | - (end_time.tv_usec - start_time.tv_usec); | ||
| 1044 | + total_time = g_date_time_difference (end_time, start_time); | ||
| 1045 | per_iteration_time = total_time / ITERATIONS; | ||
| 1046 | |||
| 1047 | + g_date_time_unref (start_time); | ||
| 1048 | + g_date_time_unref (end_time); | ||
| 1049 | + | ||
| 1050 | /* Prefix with hashes to avoid the output being misinterpreted as TAP | ||
| 1051 | * commands. */ | ||
| 1052 | printf ("# Parsing a feed %u times took:\n" | ||
| 1053 | diff --git a/gdata/tests/picasaweb.c b/gdata/tests/picasaweb.c | ||
| 1054 | index eecf1b78..19978e3c 100644 | ||
| 1055 | --- a/gdata/tests/picasaweb.c | ||
| 1056 | +++ b/gdata/tests/picasaweb.c | ||
| 1057 | @@ -782,7 +782,7 @@ typedef struct { | ||
| 1058 | static void | ||
| 1059 | set_up_insert_album (InsertAlbumData *data, gconstpointer service) | ||
| 1060 | { | ||
| 1061 | - GTimeVal timestamp; | ||
| 1062 | + GDateTime *timestamp; | ||
| 1063 | |||
| 1064 | data->album = gdata_picasaweb_album_new (NULL); | ||
| 1065 | g_assert (GDATA_IS_PICASAWEB_ALBUM (data->album)); | ||
| 1066 | @@ -791,8 +791,9 @@ set_up_insert_album (InsertAlbumData *data, gconstpointer service) | ||
| 1067 | gdata_entry_set_summary (GDATA_ENTRY (data->album), "Family photos of the feast!"); | ||
| 1068 | gdata_picasaweb_album_set_location (data->album, "Winnipeg, MN"); | ||
| 1069 | |||
| 1070 | - g_time_val_from_iso8601 ("2002-10-14T09:58:59.643554Z", ×tamp); | ||
| 1071 | - gdata_picasaweb_album_set_timestamp (data->album, (gint64) timestamp.tv_sec * 1000); | ||
| 1072 | + timestamp = g_date_time_new_from_iso8601 ("2002-10-14T09:58:59.643554Z", NULL); | ||
| 1073 | + gdata_picasaweb_album_set_timestamp (data->album, g_date_time_to_unix (timestamp) * 1000); | ||
| 1074 | + g_date_time_unref (timestamp); | ||
| 1075 | } | ||
| 1076 | |||
| 1077 | static void | ||
| 1078 | @@ -1757,12 +1758,12 @@ test_album_new (void) | ||
| 1079 | GRegex *regex; | ||
| 1080 | GMatchInfo *match_info; | ||
| 1081 | gint64 delta; | ||
| 1082 | - GTimeVal timeval; | ||
| 1083 | + GDateTime *timeval; | ||
| 1084 | |||
| 1085 | g_test_bug ("598893"); | ||
| 1086 | |||
| 1087 | /* Get the current time */ | ||
| 1088 | - g_get_current_time (&timeval); | ||
| 1089 | + timeval = g_date_time_new_now_utc (); | ||
| 1090 | |||
| 1091 | /* Build a regex to match the timestamp from the XML, since we can't definitely say what it'll be. Note that we also assign any order to the | ||
| 1092 | * namespace definitions, since due to a change in GLib's hashing algorithm, they could be in different orders with different GLib versions. */ | ||
| 1093 | @@ -1795,9 +1796,10 @@ test_album_new (void) | ||
| 1094 | xml = gdata_parsable_get_xml (GDATA_PARSABLE (album)); | ||
| 1095 | g_assert (g_regex_match (regex, xml, 0, &match_info) == TRUE); | ||
| 1096 | parsed_time_str = g_match_info_fetch (match_info, 2); | ||
| 1097 | - delta = g_ascii_strtoull (parsed_time_str, NULL, 10) - (((guint64) timeval.tv_sec) * 1000 + ((guint64) timeval.tv_usec) / 1000); | ||
| 1098 | + delta = g_ascii_strtoull (parsed_time_str, NULL, 10) - (g_date_time_to_unix (timeval) * 1000 + ((guint64) g_date_time_get_microsecond (timeval)) / 1000); | ||
| 1099 | g_assert_cmpuint (ABS (delta), <, 1000); | ||
| 1100 | |||
| 1101 | + g_date_time_unref (timeval); | ||
| 1102 | g_free (parsed_time_str); | ||
| 1103 | g_free (xml); | ||
| 1104 | g_regex_unref (regex); | ||
| 1105 | diff --git a/gdata/tests/youtube.c b/gdata/tests/youtube.c | ||
| 1106 | index 5fefbaf8..b2732680 100644 | ||
| 1107 | --- a/gdata/tests/youtube.c | ||
| 1108 | +++ b/gdata/tests/youtube.c | ||
| 1109 | @@ -1537,13 +1537,17 @@ test_comment_properties_parent_comment_uri (void) | ||
| 1110 | static gchar * | ||
| 1111 | build_this_week_date_str (void) | ||
| 1112 | { | ||
| 1113 | - GTimeVal tv; | ||
| 1114 | + GDateTime *tv, *tv2; | ||
| 1115 | + gchar *ret; | ||
| 1116 | |||
| 1117 | - g_get_current_time (&tv); | ||
| 1118 | - tv.tv_sec -= 7 * 24 * 60 * 60; /* this week */ | ||
| 1119 | - tv.tv_usec = 0; /* pointless accuracy */ | ||
| 1120 | + /* don't use g_date_time_new_now_utc (squash microseconds) */ | ||
| 1121 | + tv = g_date_time_new_from_unix_utc (g_get_real_time () / G_USEC_PER_SEC); | ||
| 1122 | + tv2 = g_date_time_add_weeks (tv, -1); | ||
| 1123 | + g_date_time_unref (tv); | ||
| 1124 | |||
| 1125 | - return g_time_val_to_iso8601 (&tv); | ||
| 1126 | + ret = g_date_time_format_iso8601 (tv2); | ||
| 1127 | + g_date_time_unref (tv2); | ||
| 1128 | + return ret; | ||
| 1129 | } | ||
| 1130 | |||
| 1131 | static void | ||
| 1132 | -- | ||
| 1133 | GitLab | ||
| 1134 | |||
diff --git a/meta-gnome/recipes-gnome/libgdata/libgdata_0.18.1.bb b/meta-gnome/recipes-gnome/libgdata/libgdata_0.18.1.bb index a65fc61feb..5f5d5834a7 100644 --- a/meta-gnome/recipes-gnome/libgdata/libgdata_0.18.1.bb +++ b/meta-gnome/recipes-gnome/libgdata/libgdata_0.18.1.bb | |||
| @@ -13,6 +13,8 @@ GTKDOC_MESON_OPTION = "gtk_doc" | |||
| 13 | 13 | ||
| 14 | inherit gnomebase pkgconfig gettext gtk-doc vala gobject-introspection manpages features_check | 14 | inherit gnomebase pkgconfig gettext gtk-doc vala gobject-introspection manpages features_check |
| 15 | 15 | ||
| 16 | SRC_URI += "file://0001-Drop-usage-of-deprecated-GTimeVal.patch" | ||
| 17 | |||
| 16 | ANY_OF_DISTRO_FEATURES = "${GTK3DISTROFEATURES}" | 18 | ANY_OF_DISTRO_FEATURES = "${GTK3DISTROFEATURES}" |
| 17 | REQUIRED_DISTRO_FEATURES = "${@bb.utils.contains('PACKAGECONFIG', 'goa', 'opengl', '', d)}" | 19 | REQUIRED_DISTRO_FEATURES = "${@bb.utils.contains('PACKAGECONFIG', 'goa', 'opengl', '', d)}" |
| 18 | 20 | ||
