summaryrefslogtreecommitdiff
path: root/gdata/tests/youtube.c
diff options
context:
space:
mode:
authorDaniel Kolesa <dkolesa@igalia.com>2021-03-16 17:22:08 +0100
committerPhilip Withnall <pwithnall@endlessos.org>2021-06-07 16:18:29 +0100
commitef8722baa444958601bfddfee3a977ccf4f7c02c (patch)
tree988cb1dbd87f3d28013a2731143c237991da2f46 /gdata/tests/youtube.c
parentcfd9c5e86cca21333bd28657c6aa9d2d24acc9f8 (diff)
downloadlibgdata-ef8722baa444958601bfddfee3a977ccf4f7c02c.tar.gz
drop usage of deprecated GTimeVal
Diffstat (limited to 'gdata/tests/youtube.c')
-rw-r--r--gdata/tests/youtube.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/gdata/tests/youtube.c b/gdata/tests/youtube.c
index 5fefbaf8..b2732680 100644
--- a/gdata/tests/youtube.c
+++ b/gdata/tests/youtube.c
@@ -1537,13 +1537,17 @@ test_comment_properties_parent_comment_uri (void)
static gchar *
build_this_week_date_str (void)
{
- GTimeVal tv;
+ GDateTime *tv, *tv2;
+ gchar *ret;
- g_get_current_time (&tv);
- tv.tv_sec -= 7 * 24 * 60 * 60; /* this week */
- tv.tv_usec = 0; /* pointless accuracy */
+ /* don't use g_date_time_new_now_utc (squash microseconds) */
+ tv = g_date_time_new_from_unix_utc (g_get_real_time () / G_USEC_PER_SEC);
+ tv2 = g_date_time_add_weeks (tv, -1);
+ g_date_time_unref (tv);
- return g_time_val_to_iso8601 (&tv);
+ ret = g_date_time_format_iso8601 (tv2);
+ g_date_time_unref (tv2);
+ return ret;
}
static void