summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Gorse <mgorse@suse.com>2022-04-12 10:30:43 -0500
committerMike Gorse <mgorse@suse.com>2022-04-12 10:30:43 -0500
commitc52a5d21b42569dfd5dce5f8568262c75f68b27d (patch)
treefbf79e5e6c0818c09b6cf7c9e7c7f732b90bb390
parent2eebdb4c2e09dd9fb34902bca472d3478cee7ca9 (diff)
downloadat-spi2-atk-c52a5d21b42569dfd5dce5f8568262c75f68b27d.tar.gz
Use g_get_monotonic_time, rather than g_get_current_time
g_get_current_time is deprecated and not year 2038 compatible.
-rw-r--r--atk-adaptor/accessible-leasing.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/atk-adaptor/accessible-leasing.c b/atk-adaptor/accessible-leasing.c
index 65b8bfc..f60d7ff 100644
--- a/atk-adaptor/accessible-leasing.c
+++ b/atk-adaptor/accessible-leasing.c
@@ -37,7 +37,7 @@ SpiLeasing *spi_global_leasing;
typedef struct _ExpiryElement
{
- guint expiry_s;
+ gint64 expiry_s;
GObject *object;
} ExpiryElement;
@@ -106,12 +106,10 @@ expiry_func (gpointer data)
SpiLeasing *leasing = SPI_LEASING (data);
ExpiryElement *head, *current;
- GTimeVal t;
-
- g_get_current_time (&t);
+ gint64 secs = g_get_monotonic_time () / 1000000;
head = g_queue_peek_head (leasing->expiry_queue);
- while (head != NULL && head->expiry_s <= t.tv_sec)
+ while (head != NULL && head->expiry_s <= secs)
{
current = g_queue_pop_head (leasing->expiry_queue);
@@ -149,7 +147,7 @@ static void
add_expiry_timeout (SpiLeasing * leasing)
{
ExpiryElement *elem;
- GTimeVal t;
+ gint64 secs = g_get_monotonic_time () / 1000000;
guint next_expiry;
if (leasing->expiry_func_id != 0)
@@ -159,9 +157,7 @@ add_expiry_timeout (SpiLeasing * leasing)
if (elem == NULL)
return;
- /* The current time is implicitly rounded down here by ignoring the us */
- g_get_current_time (&t);
- next_expiry = elem->expiry_s - t.tv_sec;
+ next_expiry = elem->expiry_s - secs;
leasing->expiry_func_id = spi_timeout_add_seconds (next_expiry,
expiry_func, leasing);
}
@@ -188,13 +184,12 @@ spi_leasing_take (SpiLeasing * leasing, GObject * object)
Check the next expiry.
*/
- GTimeVal t;
+ gint64 secs = g_get_monotonic_time () / 1000000;
guint expiry_s;
ExpiryElement *elem;
- g_get_current_time (&t);
- expiry_s = t.tv_sec + EXPIRY_TIME_S;
+ expiry_s = secs + EXPIRY_TIME_S;
elem = g_slice_new (ExpiryElement);
elem->expiry_s = expiry_s;