aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui
diff options
context:
space:
mode:
authorWill Song <incertia9474@gmail.com>2015-01-27 19:55:16 -0600
committerWill Song <incertia9474@gmail.com>2015-01-27 19:55:16 -0600
commit7f436d614b11d72893d856f1c3d817ab34b0b9eb (patch)
tree0f0692382e6976602e51643c569c6fd467040642 /src/ui
parent6529220351dd9b11c610df1c3372dd138d2af2b4 (diff)
downloadprofani-tty-7f436d614b11d72893d856f1c3d817ab34b0b9eb.tar.gz
use custom format string for time preference
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/console.c6
-rw-r--r--src/ui/window.c9
2 files changed, 5 insertions, 10 deletions
diff --git a/src/ui/console.c b/src/ui/console.c
index dd50d6d3..689f218c 100644
--- a/src/ui/console.c
+++ b/src/ui/console.c
@@ -919,12 +919,10 @@ void
cons_time_setting(void)
{
char *pref_time = prefs_get_string(PREF_TIME);
- if (g_strcmp0(pref_time, "minutes") == 0)
- cons_show("Time (/time) : minutes");
- else if (g_strcmp0(pref_time, "off") == 0)
+ if (g_strcmp0(pref_time, "off") == 0)
cons_show("Time (/time) : OFF");
else
- cons_show("Time (/time) : seconds");
+ cons_show("Time (/time) : %s", pref_time);
prefs_free_string(pref_time);
}
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));
}