13
0

fix two poorly-formed uses of Glib::DateTime

This commit is contained in:
Paul Davis 2020-03-25 10:45:00 -06:00
parent 3d6eaf8e69
commit 4b40243f2b
2 changed files with 4 additions and 11 deletions

View File

@ -962,9 +962,7 @@ ARDOUR_UI::archive_session ()
return; return;
} }
time_t n; Glib::DateTime gdt (Glib::DateTime::create_now_local ());
time (&n);
Glib::DateTime gdt (Glib::DateTime::create_now_local (n));
SessionArchiveDialog sad; SessionArchiveDialog sad;
sad.set_name (_session->name() + gdt.format ("_%F_%H%M%S")); sad.set_name (_session->name() + gdt.format ("_%F_%H%M%S"));
@ -987,8 +985,8 @@ ARDOUR_UI::quick_snapshot_session (bool switch_to_it)
if (switch_to_it && _session->dirty ()) { if (switch_to_it && _session->dirty ()) {
save_state_canfail (""); save_state_canfail ("");
} }
Glib::DateTime tm (g_date_time_new_now_local ());
save_state (tm.format ("%FT%H.%M.%S"), switch_to_it); save_state (Glib::DateTime::create_now_local().format ("%FT%H.%M.%S"), switch_to_it);
} }

View File

@ -541,12 +541,7 @@ SessionDialog::open_button_pressed (GdkEventButton* ev)
void void
SessionDialog::setup_untitled_session () SessionDialog::setup_untitled_session ()
{ {
time_t n; new_name_entry.set_text (string_compose (_("Untitled-%1"), Glib::DateTime::create_now_local().format ("%F-%H-%M-%S")));
time (&n);
struct tm* now = localtime (&n);
Glib::DateTime tm (Glib::DateTime::create_now_local (mktime (now)));
new_name_entry.set_text (string_compose (_("Untitled-%1"), tm.format ("%F-%H-%M-%S")));
new_name_entry.select_region (0, -1); new_name_entry.select_region (0, -1);
new_name_was_edited = false; new_name_was_edited = false;