diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2009-10-13 13:12:09 +0100 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2009-10-16 14:55:16 +0100 |
commit | dd8645d4c2263c40b74a4f98d0c23f6fba940e05 (patch) | |
tree | c22525fce64a48b95333f49b9be6e1ccefddc632 /telepathy-glib/debug.c | |
parent | f0e171a8cc88b401ea43415e2a64ce9ab0a5a773 (diff) | |
download | telepathy-glib-dd8645d4c2263c40b74a4f98d0c23f6fba940e05.tar.gz |
tp_debug_timestamped_log_handler: use g_time_val_to_iso8601
localtime_r is not very portable (in particular, Windows doesn't have it).
This is a behaviour change - local time to UTC, and a slightly different
format - so also update the docs.
Diffstat (limited to 'telepathy-glib/debug.c')
-rw-r--r-- | telepathy-glib/debug.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/telepathy-glib/debug.c b/telepathy-glib/debug.c index 51e20ae70..728e5c3bf 100644 --- a/telepathy-glib/debug.c +++ b/telepathy-glib/debug.c @@ -432,9 +432,9 @@ tp_debug_divert_messages (const gchar *filename) * @message: the message to process * @ignored: not used * - * A #GLogFunc that prepends the local time (currently in - * YYYY-MM-DD HH:MM:SS.SSSSSS format, with microsecond resolution) to the - * message, then calls g_log_default_handler. + * A #GLogFunc that prepends the UTC time (currently in ISO 8601 format, + * with microsecond resolution) to the message, then calls + * g_log_default_handler. * * Intended usage is: * @@ -445,6 +445,10 @@ tp_debug_divert_messages (const gchar *filename) * If telepathy-glib was compiled with --disable-debug (not recommended), * this function is equivalent to g_log_default_handler(). * + * Changed in 0.8.UNRELEASED: timestamps are now printed in UTC, in + * RFC-3339 format. Previously, they were printed in local time, in a + * format similar to RFC-3339. + * * Since: 0.7.1 */ void @@ -455,16 +459,10 @@ tp_debug_timestamped_log_handler (const gchar *log_domain, { #ifdef ENABLE_DEBUG GTimeVal now; - gchar now_str[32]; gchar *tmp; - struct tm tm; - time_t sec; g_get_current_time (&now); - sec = now.tv_sec; - localtime_r (&sec, &tm); - strftime (now_str, 32, "%Y-%m-%d %H:%M:%S", &tm); - tmp = g_strdup_printf ("%s.%06ld: %s", now_str, now.tv_usec, message); + tmp = g_time_val_to_iso8601 (&now); message = tmp; #endif |