[gvfs/wip/oholy/gtimeval-gdatetime: 8/11] ftp: Remove usage of deprecated GTimeVal



commit 82d5b6b821773c5ab17f37538dfd1834798d1922
Author: Ondrej Holy <oholy redhat com>
Date:   Mon Sep 16 17:05:58 2019 +0200

    ftp: Remove usage of deprecated GTimeVal
    
    GTimeVal is deprecated. Let's remove it in order to prevent the
    deprecation warnings.

 daemon/gvfsftpdircache.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/daemon/gvfsftpdircache.c b/daemon/gvfsftpdircache.c
index 0412ed42..04927f05 100644
--- a/daemon/gvfsftpdircache.c
+++ b/daemon/gvfsftpdircache.c
@@ -612,7 +612,7 @@ g_vfs_ftp_dir_cache_funcs_process (GInputStream *        stream,
     {
       struct list_result result = { 0, };
       GFileType file_type = G_FILE_TYPE_UNKNOWN;
-      GTimeVal tv = { 0, 0 };
+      time_t mtime;
 
       /* strip trailing \r - ParseFTPList only removes it if the line ends in \r\n,
        * but we stripped the \n already.
@@ -717,16 +717,17 @@ g_vfs_ftp_dir_cache_funcs_process (GInputStream *        stream,
       if (result.fe_time.tm_year >= 1900)
               result.fe_time.tm_year -= 1900;
 
-      tv.tv_sec = mktime (&result.fe_time);
-      if (tv.tv_sec != -1)
+      mtime = mktime (&result.fe_time);
+      if (mtime != -1)
         {
-          char *etag = g_strdup_printf ("%ld", tv.tv_sec);
+          char *etag = g_strdup_printf ("%ld", mtime);
           g_file_info_set_attribute_string (info,
                                             G_FILE_ATTRIBUTE_ETAG_VALUE,
                                             etag);
           g_free (etag);
 
-          g_file_info_set_modification_time (info, &tv);
+          g_file_info_set_attribute_uint64 (info, G_FILE_ATTRIBUTE_TIME_MODIFIED, mtime);
+          g_file_info_set_attribute_uint32 (info, G_FILE_ATTRIBUTE_TIME_MODIFIED_USEC, 0);
         }
 
       g_vfs_ftp_dir_cache_entry_add (entry, file, info);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]