summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--src/common/text.c7
-rw-r--r--src/fe-gtk/setup.c17
2 files changed, 22 insertions, 2 deletions
diff --git a/src/common/text.c b/src/common/text.c
index 93392d1a..f8afc4b3 100644
--- a/src/common/text.c
+++ b/src/common/text.c
@@ -686,6 +686,13 @@ get_stamp_str (char *fmt, time_t tim, char **ret)
 	}
 
 	len = strftime (dest, sizeof (dest), fmt, localtime (&tim));
+#ifdef WIN32
+	if (!len)
+	{
+		/* use failsafe format until a correct one is specified */
+		len = strftime (dest, sizeof (dest), "[%H:%M]", localtime (&tim));
+	}
+#endif
 	if (len)
 	{
 		if (prefs.utf8_locale)
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);