allow to customize variable i/o plugin inputs
[ardour.git] / libs / ardour / export_filename.cc
index 8186982384e130f80907bfe733370fff57b2b692..201abb934be93a08344db3a5d86a410a43907dec 100644 (file)
@@ -26,6 +26,7 @@
 #include "pbd/xml++.h"
 #include "pbd/convert.h"
 #include "pbd/enumwriter.h"
+#include "pbd/localtime_r.h"
 
 #include "ardour/libardour_visibility.h"
 #include "ardour/session.h"
@@ -62,7 +63,7 @@ ExportFilename::ExportFilename (Session & session) :
 {
        time_t rawtime;
        std::time (&rawtime);
-       time_struct = localtime (&rawtime);
+       localtime_r (&rawtime, &time_struct);
 
        folder = session.session_directory().export_path();
 
@@ -90,6 +91,7 @@ ExportFilename::get_state ()
 
        add_field (node, "label", include_label, label);
        add_field (node, "session", include_session);
+       add_field (node, "timespan", include_timespan);
        add_field (node, "revision", include_revision);
        add_field (node, "time", include_time, enum_2_string (time_format));
        add_field (node, "date", include_date, enum_2_string (date_format));
@@ -140,6 +142,9 @@ ExportFilename::set_state (const XMLNode & node)
        pair = get_field (node, "session");
        include_session = pair.first;
 
+       pair = get_field (node, "timespan");
+       include_timespan = pair.first;
+
        pair = get_field (node, "revision");
        include_revision = pair.first;
 
@@ -335,7 +340,7 @@ string
 ExportFilename::get_formatted_time (string const & format) const
 {
        char buffer [80];
-       strftime (buffer, 80, format.c_str(), time_struct);
+       strftime (buffer, 80, format.c_str(), &time_struct);
 
        string return_value (buffer);
        return return_value;