filechooser: read modification times as 64 bit

Drops the GTimeVal fallback that ends in 2038 on 32-bit systems and on
Windows, and no longer creates a GDateTime for every cell.
This commit is contained in:
Daemonratte 2026-10-17 12:13:03 +02:00
commit 944e7d9ffe

View file

@ -10409,26 +10409,12 @@ file_system_model_set (GtkFileSystemModel *model,
if (info == NULL)
break;
/* GLib 2.62 replaced the old GTimeVal API with GDateTime. */
#if GLIB_CHECK_VERSION (2, 62, 0)
{
GDateTime *dt;
dt = g_file_info_get_modification_date_time (info);
if (dt)
{
tv = g_date_time_to_unix (dt);
g_date_time_unref (dt);
}
}
#else
{
GTimeVal timeval;
g_file_info_get_modification_time (info, &timeval);
tv = timeval.tv_sec;
}
#endif
/* The seconds as GIO keeps them, 64 bits on all systems: not
* the GTimeVal of older GLib, whose glong ends in 2038 on 32-bit
* systems and on Windows, and no GDateTime made for every cell
* drawn. GIO puts st_mtime into a uint64; read as signed, a
* time before 1970 comes back as it was. */
tv = (gint64) g_file_info_get_attribute_uint64 (info, G_FILE_ATTRIBUTE_TIME_MODIFIED);
if (column == MODEL_COL_MTIME)
g_value_set_int64 (value, tv);