diff pidgin/gtkblist.c @ 17834:18b62b0fc253

Get outta my house. This adds a failsafe for the "Logged In" tooltip in the buddy list. If the logged in time is greater than two years then something is wrong (most likely the user's local clock is wrong). In that case, show the actual date the person signed on instead of showing "12 hours and 15 minutes ago" This idea courtesy of one Sean Egan. References #698
author Mark Doliner <mark@kingant.net>
date Mon, 11 Jun 2007 08:45:54 +0000
parents f13334f5717e
children 751fbc2eff7e
line wrap: on
line diff
--- a/pidgin/gtkblist.c	Mon Jun 11 08:28:17 2007 +0000
+++ b/pidgin/gtkblist.c	Mon Jun 11 08:45:54 2007 +0000
@@ -2994,7 +2994,14 @@
 		signon = purple_presence_get_login_time(presence);
 		if (full && PURPLE_BUDDY_IS_ONLINE(b) && signon > 0)
 		{
-			tmp = purple_str_seconds_to_string(time(NULL) - signon);
+			if (time(NULL) - signon > 63072000 /* 2 years */) {
+				/*
+				 * Our local clock must be wrong, show the actual
+				 * date instead of "4 days", etc.
+				 */
+				tmp = g_strdup(purple_date_format_long(localtime(&signon)));
+			} else
+				tmp = purple_str_seconds_to_string(time(NULL) - signon);
 			purple_notify_user_info_add_pair(user_info, _("Logged In"), tmp);
 			g_free(tmp);
 		}