aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorxclaesse <xclaesse@4ee84921-47dd-4033-b63a-18d7a039a3e4>2008-11-22 00:18:08 +0800
committerxclaesse <xclaesse@4ee84921-47dd-4033-b63a-18d7a039a3e4>2008-11-22 00:18:08 +0800
commit529cb10a846905fb08f2127e8494c2fd6d0d62ed (patch)
tree84f0f436e8c9ba8191b001c8c5216757991b37e8
parent6f8ff2c790cacedb218304d35ca9131e3e0fcc12 (diff)
downloadgsoc2013-empathy-529cb10a846905fb08f2127e8494c2fd6d0d62ed.tar
gsoc2013-empathy-529cb10a846905fb08f2127e8494c2fd6d0d62ed.tar.gz
gsoc2013-empathy-529cb10a846905fb08f2127e8494c2fd6d0d62ed.tar.bz2
gsoc2013-empathy-529cb10a846905fb08f2127e8494c2fd6d0d62ed.tar.lz
gsoc2013-empathy-529cb10a846905fb08f2127e8494c2fd6d0d62ed.tar.xz
gsoc2013-empathy-529cb10a846905fb08f2127e8494c2fd6d0d62ed.tar.zst
gsoc2013-empathy-529cb10a846905fb08f2127e8494c2fd6d0d62ed.zip
Use empathy_time_get_current_time instead of g_get_current_time. (Jonny Lamb)
Signed-off-by: Jonny Lamb <jonny.lamb@collabora.co.uk> git-svn-id: svn+ssh://svn.gnome.org/svn/empathy/trunk@1805 4ee84921-47dd-4033-b63a-18d7a039a3e4
-rw-r--r--libempathy/empathy-tp-file.c21
1 files changed, 6 insertions, 15 deletions
diff --git a/libempathy/empathy-tp-file.c b/libempathy/empathy-tp-file.c
index 771768e2e..fb77a4e26 100644
--- a/libempathy/empathy-tp-file.c
+++ b/libempathy/empathy-tp-file.c
@@ -287,7 +287,7 @@ struct _EmpathyTpFilePriv {
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_closed_cb (TpChannel *file_channel,
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_state_changed_cb (DBusGProxy *tp_file_iface,
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 @@ empathy_tp_file_get_transferred_bytes (EmpathyTpFile *tp_file)
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 @@ empathy_tp_file_get_remaining_time (EmpathyTpFile *tp_file)
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);
}