From ab76a49b22f792001f6bfb49bef4237429500ca2 Mon Sep 17 00:00:00 2001 From: John Emmas Date: Thu, 1 Sep 2016 12:31:33 +0100 Subject: [PATCH] Fix a bug when formatting time strings It seems that 'strftime()' (on Windows) works differently from its non-Windows counterparts. Specifically, some formatting options (e.g. %F) are not recognised in the Windows implementation. Fortunately, glibmm comes to our rescue here! So let's use the glib implementation which will hopefully work the same on all platforms. --- gtk2_ardour/ardour_ui.cc | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index f28913bab3..e9ed833c7d 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -2733,14 +2733,8 @@ ARDOUR_UI::snapshot_session (bool switch_to_it) if (switch_to_it) { prompter.set_initial_text (_session->snap_name()); } else { - char timebuf[128]; - time_t n; - struct tm local_time; - - time (&n); - localtime_r (&n, &local_time); - strftime (timebuf, sizeof(timebuf), "%FT%H.%M.%S", &local_time); - prompter.set_initial_text (timebuf); + Glib::DateTime tm (g_date_time_new_now_local ()); + prompter.set_initial_text (tm.format ("%FT%H.%M.%S")); } bool finished = false;