From 2dc0a43bc0199c8f7c3cf96b1be51ac22bb9e587 Mon Sep 17 00:00:00 2001 From: Luca Bacci Date: Thu, 29 Jun 2023 17:36:40 +0200 Subject: [PATCH] glocalfileinfo: Fix GLocalFileStat getters on MinGW x86 For some reason, `time_t` is defined as being 32 bits wide on that platform, which causes truncation of the timestamps from `struct stat`. Avoid that problem by consistently using a 64-bit return value from the `struct stat` accessors. Helps: #3039 --- gio/glocalfileinfo.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/gio/glocalfileinfo.h b/gio/glocalfileinfo.h index 729d0d3a7..b098b1980 100644 --- a/gio/glocalfileinfo.h +++ b/gio/glocalfileinfo.h @@ -316,13 +316,13 @@ inline static blkcnt_t _g_stat_blocks (const GLocalFileStat *buf) { return b #endif #ifndef G_OS_WIN32 -inline static time_t _g_stat_atime (const GLocalFileStat *buf) { return buf->st_atime; } -inline static time_t _g_stat_ctime (const GLocalFileStat *buf) { return buf->st_ctime; } -inline static time_t _g_stat_mtime (const GLocalFileStat *buf) { return buf->st_mtime; } +inline static guint64 _g_stat_atime (const GLocalFileStat *buf) { return buf->st_atime; } +inline static guint64 _g_stat_ctime (const GLocalFileStat *buf) { return buf->st_ctime; } +inline static guint64 _g_stat_mtime (const GLocalFileStat *buf) { return buf->st_mtime; } #else -inline static time_t _g_stat_atime (const GLocalFileStat *buf) { return buf->st_atim.tv_sec; } -inline static time_t _g_stat_ctime (const GLocalFileStat *buf) { return buf->st_ctim.tv_sec; } -inline static time_t _g_stat_mtime (const GLocalFileStat *buf) { return buf->st_mtim.tv_sec; } +inline static guint64 _g_stat_atime (const GLocalFileStat *buf) { return buf->st_atim.tv_sec; } +inline static guint64 _g_stat_ctime (const GLocalFileStat *buf) { return buf->st_ctim.tv_sec; } +inline static guint64 _g_stat_mtime (const GLocalFileStat *buf) { return buf->st_mtim.tv_sec; } #endif #if defined(HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC) || defined(G_OS_WIN32) inline static guint32 _g_stat_atim_nsec (const GLocalFileStat *buf) { return buf->st_atim.tv_nsec; }