mirror of https://github.com/nealey/Twatch
Actually switch labels in morning
This commit is contained in:
parent
3e1579bc6f
commit
f7a6a5bb0b
13
src/main.c
13
src/main.c
|
@ -41,8 +41,16 @@ static void bg_update_proc(Layer *layer, GContext *ctx) {
|
||||||
int hour = 3 * (i+1);
|
int hour = 3 * (i+1);
|
||||||
|
|
||||||
if (1 && clock_is_24h_style()) {
|
if (1 && clock_is_24h_style()) {
|
||||||
|
time_t epoch;
|
||||||
|
struct tm *now;
|
||||||
|
|
||||||
|
time(&epoch);
|
||||||
|
now = localtime(&epoch);
|
||||||
|
|
||||||
|
if (now->tm_hour > 12) {
|
||||||
hour += 12;
|
hour += 12;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
snprintf(s_hour[i], 3, "%d", hour);
|
snprintf(s_hour[i], 3, "%d", hour);
|
||||||
text_layer_set_text(s_hour_label[i], s_hour[i]);
|
text_layer_set_text(s_hour_label[i], s_hour[i]);
|
||||||
|
@ -120,11 +128,6 @@ static void window_load(Window *window) {
|
||||||
for (int i = 0; i < 4; i += 1) {
|
for (int i = 0; i < 4; i += 1) {
|
||||||
int x, y;
|
int x, y;
|
||||||
GTextAlignment align;
|
GTextAlignment align;
|
||||||
int hour = 3 * (i+1);
|
|
||||||
|
|
||||||
if (1 && clock_is_24h_style()) {
|
|
||||||
hour += 12;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (i) {
|
switch (i) {
|
||||||
case 0:
|
case 0:
|
||||||
|
|
Loading…
Reference in New Issue