mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-08 07:45:00 +01:00
Replace strftime() with Glib::DateTime()
This is mainly for windows compatibility "%F" is not supported. An alternative would be to s/%F/%Y-%m-%d/ to produce the ISO date.
This commit is contained in:
parent
6f29f45c81
commit
9e2b896516
2 changed files with 8 additions and 13 deletions
|
|
@ -18,6 +18,8 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <glibmm/datetime.h>
|
||||||
|
|
||||||
#include "ardour/analyser.h"
|
#include "ardour/analyser.h"
|
||||||
#include "ardour/audioengine.h"
|
#include "ardour/audioengine.h"
|
||||||
#include "ardour/audiofilesource.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->set_captured_for (_name.val());
|
||||||
as->mark_immutable ();
|
as->mark_immutable ();
|
||||||
|
|
||||||
char buf[128];
|
Glib::DateTime tm (Glib::DateTime::create_now_local (mktime (&when)));
|
||||||
strftime (buf, sizeof(buf), "%F %H.%M.%S", &when);
|
as->set_take_id (tm.format ("%F %H.%M.%S"));
|
||||||
as->set_take_id ( buf );
|
|
||||||
|
|
||||||
if (Config->get_auto_analyse_audio()) {
|
if (Config->get_auto_analyse_audio()) {
|
||||||
Analyser::queue_source_for_analysis (as, true);
|
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_natural_position (capture_info.front()->start);
|
||||||
_midi_write_source->set_captured_for (_name);
|
_midi_write_source->set_captured_for (_name);
|
||||||
|
|
||||||
char buf[128];
|
Glib::DateTime tm (Glib::DateTime::create_now_local (mktime (&when)));
|
||||||
strftime (buf, sizeof(buf), "%F %H.%M.%S", &when);
|
_midi_write_source->set_take_id (tm.format ("%F %H.%M.%S"));
|
||||||
_midi_write_source->set_take_id ( buf );
|
|
||||||
|
|
||||||
/* set length in beats to entire capture length */
|
/* set length in beats to entire capture length */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -649,14 +649,9 @@ void
|
||||||
UI::display_message (const char *prefix, gint /*prefix_len*/, RefPtr<TextBuffer::Tag> ptag, RefPtr<TextBuffer::Tag> mtag, const char *msg)
|
UI::display_message (const char *prefix, gint /*prefix_len*/, RefPtr<TextBuffer::Tag> ptag, RefPtr<TextBuffer::Tag> mtag, const char *msg)
|
||||||
{
|
{
|
||||||
RefPtr<TextBuffer> buffer (errors->text().get_buffer());
|
RefPtr<TextBuffer> buffer (errors->text().get_buffer());
|
||||||
|
Glib::DateTime tm (g_date_time_new_now_local ());
|
||||||
|
|
||||||
char timebuf[128];
|
buffer->insert_with_tag(buffer->end(), tm.format ("%FT%H:%M:%S "), ptag);
|
||||||
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(), prefix, ptag);
|
buffer->insert_with_tag(buffer->end(), prefix, ptag);
|
||||||
buffer->insert_with_tag(buffer->end(), msg, mtag);
|
buffer->insert_with_tag(buffer->end(), msg, mtag);
|
||||||
buffer->insert_with_tag(buffer->end(), "\n", mtag);
|
buffer->insert_with_tag(buffer->end(), "\n", mtag);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue