summaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorrbuj <[email protected]>2020-01-20 16:00:37 +0100
committerraveit65 <[email protected]>2020-01-31 18:52:19 +0100
commita70e19a51423b855b9da8d7f9ed40d396a534c67 (patch)
tree1fe5414f810a3fadd3fbd88673987cad60d62aac /shell
parente388b7032dda81917b05583c306a4b9690dcaa46 (diff)
downloadatril-a70e19a51423b855b9da8d7f9ed40d396a534c67.tar.bz2
atril-a70e19a51423b855b9da8d7f9ed40d396a534c67.tar.xz
Fix year 2038 issue with signed 32-bit integers
GTime is defined to always be a signed 32-bit integer, it will overflow in the year 2038.
Diffstat (limited to 'shell')
-rw-r--r--shell/ev-window.c38
1 files changed, 20 insertions, 18 deletions
diff --git a/shell/ev-window.c b/shell/ev-window.c
index 1da50613..e4cbce93 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -199,7 +199,7 @@ struct _EvWindowPrivate {
/* Document */
EvDocumentModel *model;
char *uri;
- glong uri_mtime;
+ gint64 uri_mtime;
char *local_uri;
gboolean in_reload;
EvFileMonitor *monitor;
@@ -2190,21 +2190,19 @@ set_uri_mtime (GFile *source,
EvWindow *ev_window)
{
GFileInfo *info;
- GError *error = NULL;
-
- info = g_file_query_info_finish (source, async_result, &error);
-
- if (error) {
- ev_window->priv->uri_mtime = 0;
- g_error_free (error);
- } else {
- GTimeVal mtime;
-
- g_file_info_get_modification_time (info, &mtime);
- ev_window->priv->uri_mtime = mtime.tv_sec;
+ gint utime = -1;
+
+ info = g_file_query_info_finish (source, async_result, NULL);
+ if (info) {
+ GDateTime *mtime;
+ mtime = g_file_info_get_modification_date_time (info);
+ if (mtime) {
+ utime = g_date_time_to_unix (mtime);
+ g_date_time_unref (mtime);
+ }
g_object_unref (info);
}
-
+ ev_window->priv->uri_mtime = utime;
g_object_unref (source);
}
@@ -2599,8 +2597,9 @@ query_remote_uri_mtime_cb (GFile *remote,
EvWindow *ev_window)
{
GFileInfo *info;
- GTimeVal mtime;
+ GDateTime *mtime;
GError *error = NULL;
+ gint64 utime;
info = g_file_query_info_finish (remote, async_result, &error);
if (error) {
@@ -2611,12 +2610,15 @@ query_remote_uri_mtime_cb (GFile *remote,
return;
}
- g_file_info_get_modification_time (info, &mtime);
- if (ev_window->priv->uri_mtime != mtime.tv_sec) {
+ mtime = g_file_info_get_modification_date_time (info);
+ utime = g_date_time_to_unix (mtime);
+ g_date_time_unref (mtime);
+
+ if (ev_window->priv->uri_mtime != utime) {
GFile *target_file;
/* Remote file has changed */
- ev_window->priv->uri_mtime = mtime.tv_sec;
+ ev_window->priv->uri_mtime = utime;
ev_window_reset_progress_cancellable (ev_window);