about summary refs log tree commit diff stats
path: root/src/ui/window.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/window.c')
-rw-r--r--src/ui/window.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/ui/window.c b/src/ui/window.c
index dfec5aab..7757fe39 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -36,6 +36,7 @@
 
 #include <stdlib.h>
 #include <string.h>
+#include <time.h>
 #include <assert.h>
 
 #include <glib.h>
@@ -882,14 +883,10 @@ _win_print(ProfWin *window, const char show_char, GDateTime *time,
     if ((flags & NO_DATE) == 0) {
         gchar *date_fmt = NULL;
         char *time_pref = prefs_get_string(PREF_TIME);
-        if (g_strcmp0(time_pref, "minutes") == 0) {
-            date_fmt = g_date_time_format(time, "%H:%M");
-        } else if (g_strcmp0(time_pref, "seconds") == 0) {
-            date_fmt = g_date_time_format(time, "%H:%M:%S");
-        }
+        date_fmt = g_date_time_format(time, time_pref);
         free(time_pref);
 
-        if (date_fmt) {
+        if (date_fmt && strlen(date_fmt)) {
             if ((flags & NO_COLOUR_DATE) == 0) {
                 wattron(window->layout->win, theme_attrs(THEME_TIME));
             }