diff --git a/conky.c b/conky.c index f20b4cc1..0850f983 100644 --- a/conky.c +++ b/conky.c @@ -2041,11 +2041,11 @@ static void generate_text() } seconds = tmp; if (days > 0) - snprintf(p, n, "%i days %i:%i:%i", days, hours, minutes, seconds); + snprintf(p, n, "%i days %i:%i:%02i", days, hours, minutes, seconds); else if (days > 0) - snprintf(p, n, "%i:%i:%i", hours, minutes, seconds); + snprintf(p, n, "%i:%i:%02i", hours, minutes, seconds); else - snprintf(p, n, "%i:%i", minutes, seconds); + snprintf(p, n, "%i:%02i", minutes, seconds); } OBJ(mpd_percent) { snprintf(p, n, "%2.0f", cur->mpd.progress*100); diff --git a/metarinfo.c b/metarinfo.c index c5428680..e1e86c4d 100644 --- a/metarinfo.c +++ b/metarinfo.c @@ -116,22 +116,19 @@ void *fetch_ftp() initFtp(); res = connectFtp(metar_server, 0); if (res < 0) { - ERR("Couldn't connect to %s\n", metar_server); - status = 1; - return NULL; + ERR("Couldn't connect to %s, retrying\n", metar_server); + continue; } res = changeFtpDirectory(metar_path); if (res < 0) { ERR("Metar update failed (couldn't CWD to %s)\n", metar_path); disconnectFtp(); - status = 1; - return NULL; + continue; } if (res == 0) { ERR("Metar update failed\n"); - status = 1; - return NULL; + continue; } if (getFtp(ftpData, NULL, metar_station) < 0) { ERR("Failed to get file %s\n", metar_station); @@ -161,8 +158,10 @@ void update_metar() if (!status) { status = 2; iret1 = pthread_create(&thread1, NULL, fetch_ftp, NULL); - } else if (status == 2) { /* thread is still running. what else can we do? */ - return; + } else if (status == 2) { /* thread is still running. let's kill it and start again */ + pthread_cancel(thread1); + status = 2; + iret1 = pthread_create(&thread1, NULL, fetch_ftp, NULL); } else { /* status must be 1 */ pthread_join(thread1, NULL); status = 2;