recentmanager: the age of an item and the clamping by age take the time of now from g_get_real_time(), not from a time_t, which on 32-bit systems ends in 2038, and compare the 64-bit times as they are

This commit is contained in:
Daemonratte 2026-10-17 11:12:39 +02:00
commit 469caa6587
No known key found for this signature in database

View file

@ -1742,24 +1742,23 @@ gtk_recent_manager_clamp_to_age (GtkRecentManager *manager,
GtkRecentManagerPrivate *priv = manager->priv;
gchar **uris;
gsize n_uris, i;
time_t now;
gint64 now;
if (G_UNLIKELY (!priv->recent_items))
return;
now = time (NULL);
if (now == (time_t) -1)
return;
/* not time (), which a 32-bit time_t cannot give after 2038 */
now = g_get_real_time () / G_USEC_PER_SEC;
uris = g_bookmark_file_get_uris (priv->recent_items, &n_uris);
for (i = 0; i < n_uris; i++)
{
const gchar *uri = uris[i];
time_t modified;
gint64 modified;
gint item_age;
modified = recent_time_to_time_t (gtk_recent_bookmark_file_get_modified_time (priv->recent_items, uri));
modified = gtk_recent_bookmark_file_get_modified_time (priv->recent_items, uri);
if (recent_time_get_days_elapsed (now, modified, &item_age) &&
item_age > age)
@ -2652,7 +2651,7 @@ gtk_recent_info_get_age (GtkRecentInfo *info)
g_return_val_if_fail (info != NULL, -1);
now = (gint64) time (NULL);
now = g_get_real_time () / G_USEC_PER_SEC;
if (!recent_time_get_days_elapsed (now, info->modified, &retval))
return -1;