diff --git a/panel-plugin/weather-parsers.c b/panel-plugin/weather-parsers.c index ef6f269..726d2a0 100644 --- a/panel-plugin/weather-parsers.c +++ b/panel-plugin/weather-parsers.c @@ -167,22 +167,17 @@ parse_timestring(const gchar *ts, memset(&tm, 0, sizeof(struct tm)); tm.tm_isdst = -1; - if (strptime(ts, format, &tm) != NULL) { - if (local) - t = mktime(&tm); - else - t = my_timegm(&tm); - - if (t < 0) { - memset(&t, 0, sizeof(time_t)); - return t; - } else { - return t; - } - } else { + if (strptime(ts, format, &tm) == NULL) { memset(&t, 0, sizeof(time_t)); return t; } + + t = local ? mktime(&tm) : my_timegm(&tm); + + if (t < 0) + memset(&t, 0, sizeof(time_t)); + + return t; } diff --git a/panel-plugin/weather-summary.c b/panel-plugin/weather-summary.c index 44d1874..dbe3014 100644 --- a/panel-plugin/weather-summary.c +++ b/panel-plugin/weather-summary.c @@ -1068,7 +1068,7 @@ update_summary_subtitle(plugin_data *data) { time_t now_t; GTimeVal now; - gchar *title, *date, *date_format; + gchar *title, *date; guint update_interval; gint64 now_ms; @@ -1082,13 +1082,7 @@ update_summary_subtitle(plugin_data *data) return FALSE; time(&now_t); -#ifdef HAVE_UPOWER_GLIB - if (data->upower_on_battery) - date_format = "%Y-%m-%d %H:%M:%S (%Z)"; - else -#endif - date_format = "%Y-%m-%d %H:%M:%S (%Z)"; - date = format_date(now_t, date_format, TRUE); + date = format_date(now_t, "%Y-%m-%d %H:%M:%S (%Z)", TRUE); title = g_strdup_printf("%s\n%s", data->location_name, date); g_free(date); xfce_titled_dialog_set_subtitle(XFCE_TITLED_DIALOG(data->summary_window), diff --git a/panel-plugin/weather.c b/panel-plugin/weather.c index c398381..710bd88 100644 --- a/panel-plugin/weather.c +++ b/panel-plugin/weather.c @@ -277,6 +277,7 @@ update_offset(plugin_data *data) g_free(data->offset); data->offset = g_date_time_format(dt, "%:z"); + g_date_time_unref(dt); }