[ardour-dev] [PATCH] Mantis 1401, ISO Time Stamp for Snapshot

Don Fredricks ardour at handsfull.net
Sat Jan 20 06:42:23 PST 2007


This patch is in response to Mantis #1401, which suggests that the default
name for a new snapshot should be a timestamp in ISO8601 format,
YYYY-MM-DDTHH:MM:SS. This format has the benefit of causing snapshots to
appear in chronological order in the session selection dialog.

Don

Index: gtk2_ardour/ardour_ui.cc
=================================================================== ---
gtk2_ardour/ardour_ui.cc    (revision 1305)
+++ gtk2_ardour/ardour_ui.cc    (working copy)
@@ -23,6 +23,7 @@
 #include <fcntl.h>
 #include <signal.h>
 #include <unistd.h>
+#include <time.h>
 #include <cerrno>
 #include <fstream>

@@ -1418,10 +1419,13 @@
        string snapname;
        string now;
        time_t n;
+       tm local_time;
+       char time_buf[32];

        time (&n);
-       now = ctime (&n);
-       now = now.substr (20, 4) + now.substr (3, 16) + " (" + now.substr
(0, 3) + ")";
+       localtime_r (&n, &local_time);
+       strftime (time_buf, sizeof(time_buf), "%FT%T", &local_time); +    
  now = time_buf;

        prompter.set_name ("Prompter");
        prompter.add_button (Gtk::Stock::SAVE, Gtk::RESPONSE_ACCEPT);






More information about the Ardour-Dev mailing list