diff --git a/libs/ardour/disk_writer.cc b/libs/ardour/disk_writer.cc index 482a36c889..260507f50d 100644 --- a/libs/ardour/disk_writer.cc +++ b/libs/ardour/disk_writer.cc @@ -18,6 +18,8 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#include + #include "ardour/analyser.h" #include "ardour/audioengine.h" #include "ardour/audiofilesource.h" @@ -1262,9 +1264,8 @@ DiskWriter::transport_stopped_wallclock (struct tm& when, time_t twhen, bool abo as->set_captured_for (_name.val()); as->mark_immutable (); - char buf[128]; - strftime (buf, sizeof(buf), "%F %H.%M.%S", &when); - as->set_take_id ( buf ); + Glib::DateTime tm (Glib::DateTime::create_now_local (mktime (&when))); + as->set_take_id (tm.format ("%F %H.%M.%S")); if (Config->get_auto_analyse_audio()) { Analyser::queue_source_for_analysis (as, true); @@ -1313,9 +1314,8 @@ DiskWriter::transport_stopped_wallclock (struct tm& when, time_t twhen, bool abo _midi_write_source->set_natural_position (capture_info.front()->start); _midi_write_source->set_captured_for (_name); - char buf[128]; - strftime (buf, sizeof(buf), "%F %H.%M.%S", &when); - _midi_write_source->set_take_id ( buf ); + Glib::DateTime tm (Glib::DateTime::create_now_local (mktime (&when))); + _midi_write_source->set_take_id (tm.format ("%F %H.%M.%S")); /* set length in beats to entire capture length */ diff --git a/libs/gtkmm2ext/gtk_ui.cc b/libs/gtkmm2ext/gtk_ui.cc index e6212a35bd..e38ba71d45 100644 --- a/libs/gtkmm2ext/gtk_ui.cc +++ b/libs/gtkmm2ext/gtk_ui.cc @@ -649,14 +649,9 @@ void UI::display_message (const char *prefix, gint /*prefix_len*/, RefPtr ptag, RefPtr mtag, const char *msg) { RefPtr buffer (errors->text().get_buffer()); + Glib::DateTime tm (g_date_time_new_now_local ()); - char timebuf[128]; - time_t n = time (NULL); - struct tm local_time; - localtime_r (&n, &local_time); - strftime (timebuf, sizeof(timebuf), "%FT%H:%M:%S ", &local_time); - - buffer->insert_with_tag(buffer->end(), timebuf, ptag); + buffer->insert_with_tag(buffer->end(), tm.format ("%FT%H:%M:%S "), ptag); buffer->insert_with_tag(buffer->end(), prefix, ptag); buffer->insert_with_tag(buffer->end(), msg, mtag); buffer->insert_with_tag(buffer->end(), "\n", mtag);