summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/elm_clock.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/lib/elm_clock.c b/src/lib/elm_clock.c
index 30765b9e3..4195e8321 100644
--- a/src/lib/elm_clock.c
+++ b/src/lib/elm_clock.c
@@ -817,8 +817,17 @@ _timediff_set(Elm_Clock_Data *sd)
817 tt = (time_t)(timev.tv_sec); 817 tt = (time_t)(timev.tv_sec);
818 tzset(); 818 tzset();
819 tm = localtime(&tt); 819 tm = localtime(&tt);
820 sd->timediff = (((sd->hrs - tm->tm_hour) * 60 + 820
821 sd->min - tm->tm_min) * 60) + sd->sec - tm->tm_sec; 821 if (tm)
822 {
823 sd->timediff = (((sd->hrs - tm->tm_hour) * 60 +
824 sd->min - tm->tm_min) * 60) + sd->sec - tm->tm_sec;
825 }
826 else
827 {
828 ERR("Failed to get local time!");
829 sd->timediff = 0;
830 }
822} 831}
823 832
824EOLIAN static void 833EOLIAN static void