summary refs log tree commit diff stats
path: root/src/fe-gtk/setup.c
diff options
context:
space:
mode:
authorBerke Viktor <berkeviktor@aol.com>2012-02-16 17:21:15 +0100
committerBerke Viktor <berkeviktor@aol.com>2012-02-16 17:21:15 +0100
commit0ac0510be0270cde636bbd8c590ef9fbda9d90ef (patch)
treef98afc7c26bd81b226ebe2852ef6b35f66dfe3de /src/fe-gtk/setup.c
parentfc3d4d31f01a639972faf5fd5f85fc6602f53c1b (diff)
fix for time stamp format crashes
Diffstat (limited to 'src/fe-gtk/setup.c')
-rw-r--r--src/fe-gtk/setup.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/fe-gtk/setup.c b/src/fe-gtk/setup.c
index 63cc0d30..f6acd5d6 100644
--- a/src/fe-gtk/setup.c
+++ b/src/fe-gtk/setup.c
@@ -455,7 +455,11 @@ static const setting logging_settings[] =
 	{ST_HEADER,	N_("Time Stamps"),0,0,0},
 	{ST_TOGGLE,	N_("Insert timestamps in logs"), P_OFFINTNL(timestamp_logs), 0, 0, 2},
 	{ST_ENTRY,	N_("Log timestamp format:"), P_OFFSETNL(timestamp_log_format), 0, 0, sizeof prefs.timestamp_log_format},
-	{ST_LABEL,	N_("See strftime manpage for details.")},
+#ifdef WIN32
+	{ST_LABEL,	N_("See the strftime MSDN article for details.")},
+#else
+	{ST_LABEL,	N_("See the strftime manpage for details.")},
+#endif
 
 	{ST_END, 0, 0, 0, 0, 0}
 };
@@ -2065,6 +2069,7 @@ setup_apply (struct xchatprefs *pr)
 	PangoFontDescription *old_desc;
 	PangoFontDescription *new_desc;
 	char buffer[4 * FONTNAMELEN + 1];
+	time_t rawtime;
 #endif
 	int new_pix = FALSE;
 	int noapply = FALSE;
@@ -2109,7 +2114,8 @@ setup_apply (struct xchatprefs *pr)
 
 	memcpy (&prefs, pr, sizeof (prefs));
 
-#ifdef WIN32	/* merge font_main and font_alternative into font_normal */
+#ifdef WIN32
+	/* merge font_main and font_alternative into font_normal */
 	old_desc = pango_font_description_from_string (prefs.font_main);
 	sprintf (buffer, "%s,%s", pango_font_description_get_family (old_desc), prefs.font_alternative);
 	new_desc = pango_font_description_from_string (buffer);
@@ -2122,6 +2128,13 @@ setup_apply (struct xchatprefs *pr)
 	g_free (old_desc);
 	g_free (new_desc);
 	*/
+
+	/* workaround for strftime differences between POSIX and MSVC */
+	time (&rawtime);
+	if(!strftime (buffer, sizeof (buffer), prefs.stamp_format, localtime (&rawtime)) || !strftime (buffer, sizeof (buffer), prefs.timestamp_log_format, localtime (&rawtime)))
+	{
+		fe_message (_("Invalid time stamp format! See the strftime MSDN article for details."), FE_MSG_ERROR);
+	}
 #endif
 
 	setup_apply_real (new_pix, do_ulist, do_layout);