diff options
author | tamasmeszaros <meszaros.q@gmail.com> | 2019-09-24 11:48:24 +0300 |
---|---|---|
committer | tamasmeszaros <meszaros.q@gmail.com> | 2019-10-02 15:44:11 +0300 |
commit | d5dcba00b1081cf15324d3d5eb8eae4a4701386c (patch) | |
tree | 8ad475bea2d41683ae4a81ba721cba931c5a7ef1 /src/slic3r/GUI/ConfigSnapshotDialog.cpp | |
parent | f29e18dad2eff92f29b75e505174453e05139f81 (diff) |
Time conversion functions with tests.
Fixes issue with incorrect characters in time strings on UI.
Fix platform dependency
Fix return value with incorrect strings.
Just use strptime and strftime on all platforms.
Emulate strptime on msvc... because they don't have it and their get_time is buggy.
Diffstat (limited to 'src/slic3r/GUI/ConfigSnapshotDialog.cpp')
-rw-r--r-- | src/slic3r/GUI/ConfigSnapshotDialog.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/slic3r/GUI/ConfigSnapshotDialog.cpp b/src/slic3r/GUI/ConfigSnapshotDialog.cpp index c89e4895e..d48dfccc9 100644 --- a/src/slic3r/GUI/ConfigSnapshotDialog.cpp +++ b/src/slic3r/GUI/ConfigSnapshotDialog.cpp @@ -35,9 +35,14 @@ static wxString generate_html_row(const Config::Snapshot &snapshot, bool row_eve text += snapshot_active ? "#B3FFCB" : (row_even ? "#FFFFFF" : "#D5D5D5"); text += "\">"; text += "<td>"; + + static const constexpr char *LOCALE_TIME_FMT = "%x %X"; + wxString datetime = wxDateTime(snapshot.time_captured).Format(LOCALE_TIME_FMT); + // Format the row header. - text += wxString("<font size=\"5\"><b>") + (snapshot_active ? _(L("Active")) + ": " : "") + - Utils::format_local_date_time(snapshot.time_captured) + ": " + format_reason(snapshot.reason); + text += wxString("<font size=\"5\"><b>") + (snapshot_active ? _(L("Active")) + ": " : "") + + datetime + ": " + format_reason(snapshot.reason); + if (! snapshot.comment.empty()) text += " (" + wxString::FromUTF8(snapshot.comment.data()) + ")"; text += "</b></font><br>"; |