summaryrefslogtreecommitdiff
path: root/libs/ardour/export_filename.cc
diff options
context:
space:
mode:
authorJulien ROGER <gulien.roger@gmail.com>2016-02-11 03:46:51 +0100
committerTim Mayberry <mojofunk@gmail.com>2016-02-13 12:45:40 +1000
commita3dd27c41bff52a0c5216b768f98e3b8adf77108 (patch)
tree73995b8e66a5e8dba304b65882b247ecc09c5fd5 /libs/ardour/export_filename.cc
parent1fbe4253aafc8821f5d9db0d7e99fcb1712c4cc5 (diff)
Fix 6677: Post-export script reinterprets timestamp format placeholder giving incorrect filename
Due to localtime and its statically allocated buffer, time_struct variable is set at construct time but its value changes over time due to subsequent calls to localtime in ardour process. Replacing localtime by localtime_r fix the problem. This also fix 6713: Name of Audio (timestamp) does not match with written Filename in CD-Cue file
Diffstat (limited to 'libs/ardour/export_filename.cc')
-rw-r--r--libs/ardour/export_filename.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/libs/ardour/export_filename.cc b/libs/ardour/export_filename.cc
index 19ead2d026..201abb934b 100644
--- a/libs/ardour/export_filename.cc
+++ b/libs/ardour/export_filename.cc
@@ -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();
@@ -339,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;