diff options
author | David Laban <david.laban@collabora.co.uk> | 2011-05-18 19:34:50 -0400 |
---|---|---|
committer | David Laban <david.laban@collabora.co.uk> | 2011-05-18 19:34:50 -0400 |
commit | 023fd3ba6e689cd720b8bbd4af7dbd3757162407 (patch) | |
tree | 917b735b1036e0fb045a2eeb91724571be8e91c2 /telepathy-logger/text-channel.c | |
parent | ce54dc822df517b18cefa9169ea8f03e9946669c (diff) | |
download | telepathy-logger-023fd3ba6e689cd720b8bbd4af7dbd3757162407.tar.gz |
get_message_timestamp: debug if timestamp is wildly out
Hopefully, this will help CM authors a little.
Diffstat (limited to 'telepathy-logger/text-channel.c')
-rw-r--r-- | telepathy-logger/text-channel.c | 14 |
1 files changed, 9 insertions, 5 deletions
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; } |