From a48bfc9c576363c428e11dcfad7da07988fc5beb Mon Sep 17 00:00:00 2001 From: martin Date: Mon, 9 Jun 2008 20:13:30 +0200 Subject: [PATCH] add OC for 12h format --- clock.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/clock.c b/clock.c index 10efa37..da46490 100644 --- a/clock.c +++ b/clock.c @@ -223,19 +223,14 @@ check_key(void) { void get_time(void) { int i; + int ihour; tm = localtime(<); lt = time(NULL); - int ihour; - - ihour = tm->tm_hour; - if(enable_tw && ihour > 12) { - ihour -= 12; - } + ihour = tm->tm_hour; - if(enable_tw && !ihour){ - ihour = 12; - } + ihour = (enable_tw && ihour > 12) ? ihour - 12 : ihour; + ihour = (enable_tw && !ihour) ? 12 : ihour; hour[0] = ihour / 10; hour[1] = ihour % 10;