use - for unknown duration

This commit is contained in:
Erica Z 2024-10-16 13:07:14 +02:00
parent 19dd3b13e2
commit 6bdf5d7e5c

View file

@ -135,6 +135,10 @@ class Ui.Window : Adw.ApplicationWindow {
} }
[GtkCallback] private string format_timestamp (int64 ns) { [GtkCallback] private string format_timestamp (int64 ns) {
if (ns == 1) {
// treat 1 nanosecond as a sentinel value
return "-";
}
int64 ms = ns / 1000000; int64 ms = ns / 1000000;
int s = (int) (ms / 1000); int s = (int) (ms / 1000);
return "%02d:%02d".printf (s/60, s%60); return "%02d:%02d".printf (s/60, s%60);