diff options
author | Robin Gareus <robin@gareus.org> | 2020-03-08 23:31:51 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2020-03-08 23:31:51 +0100 |
commit | 9e2b896516c6ae26ebf1b55a674c1366154d64e2 (patch) | |
tree | b3a23357a8df0988779b851b686b7fba6dcaa305 /libs/gtkmm2ext | |
parent | 6f29f45c8144f0512114fe9ea4e9a768d75501f7 (diff) |
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.
Diffstat (limited to 'libs/gtkmm2ext')
-rw-r--r-- | libs/gtkmm2ext/gtk_ui.cc | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/libs/gtkmm2ext/gtk_ui.cc b/libs/gtkmm2ext/gtk_ui.cc index e6212a35bd..e38ba71d45 100644 --- a/libs/gtkmm2ext/gtk_ui.cc +++ b/libs/gtkmm2ext/gtk_ui.cc @@ -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) { RefPtr<TextBuffer> buffer (errors->text().get_buffer()); + Glib::DateTime tm (g_date_time_new_now_local ()); - char timebuf[128]; - 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(), tm.format ("%FT%H:%M:%S "), ptag); buffer->insert_with_tag(buffer->end(), prefix, ptag); buffer->insert_with_tag(buffer->end(), msg, mtag); buffer->insert_with_tag(buffer->end(), "\n", mtag); |