summaryrefslogtreecommitdiffhomepage
path: root/editor/update.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2024-03-01 21:06:48 +0100
committerStanislaw Halik <sthalik@misaki.pl>2024-03-01 21:33:18 +0100
commit52b8ef97891061fcf4e57a7f07b6e1b4e1898f2b (patch)
tree797711cd0af15d8b6588c15acd8fd8fb9c98742b /editor/update.cpp
parentf9767c694e85fe774a68072f10facc5fcf4c6403 (diff)
editor: make the timestamp a bit more useful
Diffstat (limited to 'editor/update.cpp')
-rw-r--r--editor/update.cpp24
1 files changed, 18 insertions, 6 deletions
diff --git a/editor/update.cpp b/editor/update.cpp
index dffc1fdd..8c3349e5 100644
--- a/editor/update.cpp
+++ b/editor/update.cpp
@@ -124,13 +124,25 @@ void app::do_rotate(bool backward)
void app::do_emit_timestamp()
{
- static struct
- {
- Time time = Time::now();
- unsigned ctr = 0;
- } s;
+ constexpr const char* prefix = " -- MARK -- ";
+
+ static unsigned counter;
+ const auto now = Time::now();
+ const auto time = (double)Time::to_milliseconds(now - Time{_timestamp});
char buf[fm_DATETIME_BUF_SIZE];
- fm_debug("%s -- MARK -- 0x%08X", format_datetime_to_string(buf), ++s.ctr & 0xffff'ffffU);
+ format_datetime_to_string(buf);
+
+ if (time >= 1e5f)
+ fm_debug("%s%s0x%08x %.2f" " s", buf, prefix, counter++, time*1e-3);
+ else if (time >= 1e4f)
+ fm_debug("%s%s0x%08x %.2f" " s", buf, prefix, counter++, time*1e-3);
+ else if (time >= 1e3f)
+ fm_debug("%s%s0x%08x %.2f" " ms", buf, prefix, counter++, time);
+ else if (time > 0)
+ fm_debug("%s%s0x%08x %.4f" " ms", buf, prefix, counter++, time);
+ else
+ fm_debug("%s%s0x%08x 0" " ms", buf, prefix, counter++);
+ _timestamp = now.stamp;
}
void app::do_set_mode(editor_mode mode)