From 023fd3ba6e689cd720b8bbd4af7dbd3757162407 Mon Sep 17 00:00:00 2001 From: David Laban Date: Wed, 18 May 2011 19:34:50 -0400 Subject: get_message_timestamp: debug if timestamp is wildly out Hopefully, this will help CM authors a little. --- telepathy-logger/text-channel.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'telepathy-logger/text-channel.c') diff --git a/telepathy-logger/text-channel.c b/telepathy-logger/text-channel.c index 5af8dfa..899d3af 100644 --- a/telepathy-logger/text-channel.c +++ b/telepathy-logger/text-channel.c @@ -310,6 +310,8 @@ get_message_pending_id (TpMessage *m) static guint get_message_timestamp (TpMessage *message) { + GDateTime *datetime = g_date_time_new_now_utc (); + guint64 now = g_date_time_to_unix (datetime); gint64 timestamp; timestamp = tp_message_get_sent_timestamp (message); @@ -317,13 +319,15 @@ get_message_timestamp (TpMessage *message) if (timestamp == 0) timestamp = tp_message_get_received_timestamp (message); + if (timestamp - now > 60 * 60) + DEBUG ("timestamp is more than an hour in the future."); + else if (now - timestamp > 60 * 60) + DEBUG ("timestamp is more than an hour in the past."); + if (timestamp == 0) - { - GDateTime *datetime = g_date_time_new_now_utc (); - timestamp = g_date_time_to_unix (datetime); - g_date_time_unref (datetime); - } + timestamp = now; + g_date_time_unref (datetime); return timestamp; } -- cgit v1.2.1