diff --git a/src/sysprof/sysprof-recording-pad.c b/src/sysprof/sysprof-recording-pad.c index 58633af1..7d78ff7e 100644 --- a/src/sysprof/sysprof-recording-pad.c +++ b/src/sysprof/sysprof-recording-pad.c @@ -42,6 +42,17 @@ G_DEFINE_FINAL_TYPE (SysprofRecordingPad, sysprof_recording_pad, ADW_TYPE_WINDOW static GParamSpec *properties[N_PROPS]; +static char * +format_time (GObject *unused, + gint64 duration) +{ + double elapsed = duration / (double)G_USEC_PER_SEC; + int minutes = floor (elapsed / 60); + int seconds = floor (elapsed - (minutes * 60)); + + return g_strdup_printf ("%02u:%02u", minutes, seconds); +} + static gboolean sysprof_recording_pad_close_request (GtkWindow *window) { @@ -127,6 +138,7 @@ sysprof_recording_pad_class_init (SysprofRecordingPadClass *klass) gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/sysprof/sysprof-recording-pad.ui"); gtk_widget_class_bind_template_child (widget_class, SysprofRecordingPad, stop_button); + gtk_widget_class_bind_template_callback (widget_class, format_time); } static void diff --git a/src/sysprof/sysprof-recording-pad.ui b/src/sysprof/sysprof-recording-pad.ui index 40a1810d..1f6871e0 100644 --- a/src/sysprof/sysprof-recording-pad.ui +++ b/src/sysprof/sysprof-recording-pad.ui @@ -1,6 +1,9 @@