1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-11-17 10:35:10 +00:00
git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky@31 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
Brenden Matthews 2005-07-30 20:45:17 +00:00
parent afb4ebe41e
commit be35e6bc6e
2 changed files with 11 additions and 12 deletions

View File

@ -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);

View File

@ -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;