From f7a6a5bb0be1ab38925a177bb0a3e0b98b9afffc Mon Sep 17 00:00:00 2001 From: Neale Pickett Date: Tue, 21 Jul 2015 06:32:13 -0600 Subject: [PATCH] Actually switch labels in morning --- src/main.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/main.c b/src/main.c index e1f9a2b..5954422 100644 --- a/src/main.c +++ b/src/main.c @@ -41,7 +41,15 @@ static void bg_update_proc(Layer *layer, GContext *ctx) { int hour = 3 * (i+1); if (1 && clock_is_24h_style()) { - hour += 12; + time_t epoch; + struct tm *now; + + time(&epoch); + now = localtime(&epoch); + + if (now->tm_hour > 12) { + hour += 12; + } } snprintf(s_hour[i], 3, "%d", hour); @@ -120,11 +128,6 @@ static void window_load(Window *window) { for (int i = 0; i < 4; i += 1) { int x, y; GTextAlignment align; - int hour = 3 * (i+1); - - if (1 && clock_is_24h_style()) { - hour += 12; - } switch (i) { case 0: