# HG changeset patch
# Node ID bfa3870a5500
# Parent  b147a2ac58f0
diff --git a/ChangeLog.API b/ChangeLog.API
--- a/ChangeLog.API
+++ b/ChangeLog.API
@@ -667,6 +667,7 @@
 		* purple_txt_resolve_account
 		* PurpleType, use GType instead.
 		* purple_utf8_salvage.  Use g_utf8_make_valid instead.
+		* purple_utf8_strftime
 		* purple_util_write_data_to_file_absolute.  Use g_file_set_contents
 		  instead.
 		* purple_util_fetch_url_len. Use purple_util_fetch_url, instead.
diff --git a/finch/gntdebug.c b/finch/gntdebug.c
--- a/finch/gntdebug.c
+++ b/finch/gntdebug.c
@@ -130,8 +130,8 @@
 	const gchar *search_str = NULL;
 	gint pos = 0;
 	GntTextFormatFlags flag = 0;
-	const char *mdate = NULL;
-	time_t mtime;
+	GDateTime *local_date_time = NULL;
+	gchar *local_time = NULL;
 	gsize i;
 
 	if (debug.window == NULL || debug.paused) {
@@ -165,10 +165,14 @@
 	}
 
 	pos = gnt_text_view_get_lines_below(GNT_TEXT_VIEW(debug.tview));
-	mtime = time(NULL);
-	mdate = purple_utf8_strftime("%H:%M:%S ", localtime(&mtime));
-	gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(debug.tview), mdate,
+
+	local_date_time = g_date_time_new_now_local();
+	local_time = g_date_time_format(local_date_time, "%H:%M:%S ");
+	g_date_time_unref(local_date_time);
+
+	gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(debug.tview), local_time,
 	                                     GNT_TEXT_FLAG_NORMAL);
+	g_free(local_time);
 
 	gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(debug.tview), domain,
 	                                     GNT_TEXT_FLAG_BOLD);
diff --git a/libpurple/util.h b/libpurple/util.h
--- a/libpurple/util.h
+++ b/libpurple/util.h
@@ -89,35 +89,6 @@
 /**************************************************************************/
 
 /**
- * purple_utf8_strftime:
- * @format: The format string, in UTF-8
- * @tm:     The time to format, or %NULL to use the current local time
- *
- * Formats a time into the specified format.
- *
- * This is essentially strftime(), but it has a static buffer
- * and handles the UTF-8 conversion for the caller.
- *
- * This function also provides the GNU \%z formatter if the underlying C
- * library doesn't.  However, the format string parser is very naive, which
- * means that conversions specifiers to \%z cannot be guaranteed.  The GNU
- * strftime(3) man page describes \%z as: 'The time-zone as hour offset from
- * GMT.  Required to emit RFC822-conformant dates
- * (using "\%a, \%d \%b \%Y \%H:\%M:\%S \%z"). (GNU)'
- *
- * On Windows, this function also converts the results for \%Z from a timezone
- * name (as returned by the system strftime() \%Z format string) to a timezone
- * abbreviation (as is the case on Unix).  As with \%z, conversion specifiers
- * should not be used.
- *
- * Note: @format is required to be in UTF-8.  This differs from strftime(),
- *       where the format is provided in the locale charset.
- *
- * Returns: The formatted time, in UTF-8.
- */
-const char *purple_utf8_strftime(const char *format, const struct tm *tm);
-
-/**
  * purple_date_format_full:
  * @tm: The time to format, or %NULL to use the current local time
  *
diff --git a/libpurple/util.c b/libpurple/util.c
--- a/libpurple/util.c
+++ b/libpurple/util.c
@@ -48,16 +48,13 @@
 /**************************************************************************
  * Date/Time Functions
  **************************************************************************/
-
 const char *
-purple_utf8_strftime(const char *format, const struct tm *tm)
+purple_date_format_full(const struct tm *tm)
 {
 	static char buf[128];
 	GDateTime *dt;
 	char *utf8;
 
-	g_return_val_if_fail(format != NULL, NULL);
-
 	if (tm == NULL)
 	{
 		dt = g_date_time_new_now_local();
@@ -67,12 +64,12 @@
 				tm->tm_min, tm->tm_sec);
 	}
 
-	utf8 = g_date_time_format(dt, format);
+	utf8 = g_date_time_format(dt, "%c");
 	g_date_time_unref(dt);
 
 	if (utf8 == NULL) {
 		purple_debug_error("util",
-				"purple_utf8_strftime(): Formatting failed\n");
+				"purple_date_format_full(): Formatting failed\n");
 		return "";
 	}
 
@@ -81,12 +78,6 @@
 	return buf;
 }
 
-const char *
-purple_date_format_full(const struct tm *tm)
-{
-	return purple_utf8_strftime("%c", tm);
-}
-
 /**************************************************************************
  * Path/Filename Functions
  **************************************************************************/
diff --git a/pidgin/pidgindebug.c b/pidgin/pidgindebug.c
--- a/pidgin/pidgindebug.c
+++ b/pidgin/pidgindebug.c
@@ -689,8 +689,8 @@
 	const gchar *domain = NULL;
 	const gchar *arg_s = NULL;
 	GtkTextTag *level_tag = NULL;
-	const char *mdate = NULL;
-	time_t mtime;
+	GDateTime *local_date_time = NULL;
+	gchar *local_time = NULL;
 	GtkTextIter end;
 	gboolean scroll;
 	gsize i;
@@ -732,17 +732,21 @@
 	gtk_text_buffer_get_end_iter(debug_win->buffer, &end);
 	gtk_text_buffer_move_mark(debug_win->buffer, debug_win->start_mark, &end);
 
-	mtime = time(NULL);
-	mdate = purple_utf8_strftime("(%H:%M:%S) ", localtime(&mtime));
+	local_date_time = g_date_time_new_now_local();
+	local_time = g_date_time_format(local_date_time, "(%H:%M:%S) ");
+	g_date_time_unref(local_date_time);
+
 	gtk_text_buffer_insert_with_tags(
 			debug_win->buffer,
 			&end,
-			mdate,
+			local_time,
 			-1,
 			level_tag,
 			debug_win->paused ? debug_win->tags.paused : NULL,
 			NULL);
 
+	g_free(local_time);
+
 	if (domain != NULL && *domain != '\0') {
 		gtk_text_buffer_insert_with_tags(
 				debug_win->buffer,
