[epiphany/wip/ephy-sync: 85/86] sync-bookmarks: Apparently float ruins the precision of timestamps. Use double instead



commit 1078ce75c17186b2228f02181705501ca960898a
Author: Gabriel Ivascu <ivascu gabriel59 gmail com>
Date:   Sat Jul 30 19:26:19 2016 +0300

    sync-bookmarks: Apparently float ruins the precision of timestamps. Use double instead

 src/ephy-bookmark.c     |    6 +++---
 src/ephy-bookmark.h     |    4 ++--
 src/ephy-sync-service.c |   16 ++++++++--------
 src/ephy-sync-service.h |    4 ++--
 4 files changed, 15 insertions(+), 15 deletions(-)
---
diff --git a/src/ephy-bookmark.c b/src/ephy-bookmark.c
index a20afe0..b49800b 100644
--- a/src/ephy-bookmark.c
+++ b/src/ephy-bookmark.c
@@ -34,7 +34,7 @@ struct _EphyBookmark {
   GSequence   *tags;
 
   char        *id;
-  float        modified;
+  double       modified;
 };
 
 static JsonSerializableIface *serializable_iface = NULL;
@@ -272,7 +272,7 @@ ephy_bookmark_get_id (EphyBookmark *self)
   return self->id;
 }
 
-float
+double
 ephy_bookmark_get_modified (EphyBookmark *self)
 {
   g_return_val_if_fail (EPHY_IS_BOOKMARK (self), -1);
@@ -282,7 +282,7 @@ ephy_bookmark_get_modified (EphyBookmark *self)
 
 void
 ephy_bookmark_set_modified (EphyBookmark *self,
-                            float         modified)
+                            double        modified)
 {
   g_return_if_fail (EPHY_IS_BOOKMARK (self));
 
diff --git a/src/ephy-bookmark.h b/src/ephy-bookmark.h
index 21f6aa7..14c2c23 100644
--- a/src/ephy-bookmark.h
+++ b/src/ephy-bookmark.h
@@ -34,9 +34,9 @@ const char          *ephy_bookmark_get_url      (EphyBookmark *self);
 const char          *ephy_bookmark_get_title    (EphyBookmark *self);
 
 const char          *ephy_bookmark_get_id       (EphyBookmark *self);
-float                ephy_bookmark_get_modified (EphyBookmark *self);
+double               ephy_bookmark_get_modified (EphyBookmark *self);
 void                 ephy_bookmark_set_modified (EphyBookmark *self,
-                                                 float         modified);
+                                                 double        modified);
 
 void                 ephy_bookmark_add_tag      (EphyBookmark *self,
                                                  const char   *tag);
diff --git a/src/ephy-sync-service.c b/src/ephy-sync-service.c
index 0136088..657a3ec 100644
--- a/src/ephy-sync-service.c
+++ b/src/ephy-sync-service.c
@@ -68,8 +68,8 @@ typedef struct {
   gchar               *endpoint;
   const gchar         *method;
   gchar               *request_body;
-  float                modified_since;
-  float                unmodified_since;
+  double               modified_since;
+  double               unmodified_since;
   SoupSessionCallback  callback;
   gpointer             user_data;
 } StorageServerRequestAsyncData;
@@ -79,8 +79,8 @@ storage_server_request_async_data_new (EphySyncService     *service,
                                        gchar               *endpoint,
                                        const gchar         *method,
                                        gchar               *request_body,
-                                       float                modified_since,
-                                       float                unmodified_since,
+                                       double               modified_since,
+                                       double               unmodified_since,
                                        SoupSessionCallback  callback,
                                        gpointer             user_data)
 {
@@ -319,13 +319,13 @@ ephy_sync_service_send_storage_request (EphySyncService               *self,
   }
 
   if (data->modified_since >= 0) {
-    if_modified_since = g_strdup_printf ("%.2f", data->modified_since);
+    if_modified_since = g_strdup_printf ("%.2lf", data->modified_since);
     soup_message_headers_append (message->request_headers,
                                  "X-If-Modified-Since", if_modified_since);
   }
 
   if (data->unmodified_since >= 0) {
-    if_unmodified_since = g_strdup_printf ("%.2f", data->unmodified_since);
+    if_unmodified_since = g_strdup_printf ("%.2lf", data->unmodified_since);
     soup_message_headers_append (message->request_headers,
                                  "X-If-Unmodified-Since", if_unmodified_since);
   }
@@ -930,8 +930,8 @@ ephy_sync_service_send_storage_message (EphySyncService     *self,
                                         gchar               *endpoint,
                                         const gchar         *method,
                                         gchar               *request_body,
-                                        float                modified_since,
-                                        float                unmodified_since,
+                                        double               modified_since,
+                                        double               unmodified_since,
                                         SoupSessionCallback  callback,
                                         gpointer             user_data)
 {
diff --git a/src/ephy-sync-service.h b/src/ephy-sync-service.h
index b9eaa7f..6623bad 100644
--- a/src/ephy-sync-service.h
+++ b/src/ephy-sync-service.h
@@ -74,8 +74,8 @@ void             ephy_sync_service_send_storage_message (EphySyncService     *se
                                                          gchar               *endpoint,
                                                          const gchar         *method,
                                                          gchar               *request_body,
-                                                         float                modified_since,
-                                                         float                unmodified_since,
+                                                         double               modified_since,
+                                                         double               unmodified_since,
                                                          SoupSessionCallback  callback,
                                                          gpointer             user_data);
 


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