empathy r1805 - trunk/libempathy



Author: xclaesse
Date: Fri Nov 21 16:18:08 2008
New Revision: 1805
URL: http://svn.gnome.org/viewvc/empathy?rev=1805&view=rev

Log:
Use empathy_time_get_current_time instead of g_get_current_time. (Jonny Lamb)

Signed-off-by: Jonny Lamb <jonny lamb collabora co uk>

Modified:
   trunk/libempathy/empathy-tp-file.c

Modified: trunk/libempathy/empathy-tp-file.c
==============================================================================
--- trunk/libempathy/empathy-tp-file.c	(original)
+++ trunk/libempathy/empathy-tp-file.c	Fri Nov 21 16:18:08 2008
@@ -287,7 +287,7 @@
   EmpFileTransferStateChangeReason state_change_reason;
   guint64 size;
   guint64 transferred_bytes;
-  gint64 start_time;
+  time_t start_time;
   gchar *unix_socket_path;
   gchar *content_hash;
   EmpFileHashType content_hash_type;
@@ -394,15 +394,6 @@
   tp_file_destroy_cb (file_channel, tp_file);
 }
 
-static gint64
-get_time_msec (void)
-{
-  GTimeVal tv;
-
-  g_get_current_time (&tv);
-  return ((gint64) tv.tv_sec) * 1000 + tv.tv_usec / 1000;
-}
-
 static gint
 _get_local_socket (EmpathyTpFile *tp_file)
 {
@@ -492,7 +483,7 @@
       tp_file->priv->filename, tp_file->priv->state, state, reason);
 
   if (state == EMP_FILE_TRANSFER_STATE_OPEN)
-    tp_file->priv->start_time = get_time_msec ();
+    tp_file->priv->start_time = empathy_time_get_current ();
 
   DEBUG ("state = %u, incoming = %s, in_stream = %s, out_stream = %s",
       state, tp_file->priv->incoming ? "yes" : "no",
@@ -885,7 +876,7 @@
 gint
 empathy_tp_file_get_remaining_time (EmpathyTpFile *tp_file)
 {
-  gint64 curr_time, elapsed_time;
+  time_t curr_time, elapsed_time;
   gdouble time_per_byte;
   gdouble remaining_time;
 
@@ -897,12 +888,12 @@
   if (tp_file->priv->transferred_bytes == tp_file->priv->size)
     return 0;
 
-  curr_time = get_time_msec ();
+  curr_time = empathy_time_get_current ();
   elapsed_time = curr_time - tp_file->priv->start_time;
   time_per_byte = (gdouble) elapsed_time /
       (gdouble) tp_file->priv->transferred_bytes;
-  remaining_time = (time_per_byte * (tp_file->priv->size -
-      tp_file->priv->transferred_bytes)) / 1000;
+  remaining_time = time_per_byte * (tp_file->priv->size -
+      tp_file->priv->transferred_bytes);
 
   return (gint) (remaining_time + 0.5);
 }



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