[Pkg-wmaker-commits] [wmforecast] 05/11: wmforecast.c: Keep track of last time weather was retrieved; display in balloon.

Doug Torrance dtorrance-guest at moszumanska.debian.org
Sun Sep 20 16:38:15 UTC 2015


This is an automated email from the git hooks/post-receive script.

dtorrance-guest pushed a commit to branch upstream
in repository wmforecast.

commit 4691fc6ed3dbcecad8d47ab8350a7f89c6b9b61c
Author: Doug Torrance <dtorrance at monmouthcollege.edu>
Date:   Sun Nov 16 00:24:42 2014 -0600

    wmforecast.c: Keep track of last time weather was retrieved; display in balloon.
---
 wmforecast.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/wmforecast.c b/wmforecast.c
index 745bcd8..dd31f8c 100755
--- a/wmforecast.c
+++ b/wmforecast.c
@@ -100,6 +100,7 @@ typedef struct {
 	RImage *icon;
 	int errorFlag;
 	char *errorText;
+	char retrieved[20];
 } Weather;
 
 Forecast *newForecast()
@@ -181,7 +182,6 @@ void setError(Weather *weather, WMScreen *screen, const char *errorText)
 	strcpy(weather->errorText, errorText);
 }
 
-
 void setConditions(Weather *weather,
 		   WMScreen *screen,
 		   const char *temp,
@@ -192,6 +192,7 @@ void setConditions(Weather *weather,
 {
 	RContext *context;
 	char *filename;
+	time_t currentTime;
 
 	weather->temp = wrealloc(weather->temp, strlen(temp) + 1);
 	strcpy(weather->temp, temp);
@@ -212,6 +213,10 @@ void setConditions(Weather *weather,
 			WMCreateNamedColor(screen, background, True));
 		RCombineImageWithColor(weather->icon, &color);
 	}
+
+	currentTime = time(NULL);
+	strftime(weather->retrieved, sizeof weather->retrieved, "%l:%M %P %Z",
+		 localtime(&currentTime));
 }
 
 void setForecast(Forecast *forecast,
@@ -323,6 +328,8 @@ char *getBalloonText(Weather *weather)
 	int i;
 
 	text = wstrconcat("\n", weather->title);
+	text = wstrappend(text, "\nRetrieved: ");
+	text = wstrappend(text, weather->retrieved);
 	text = wstrappend(text, "\n\nCurrent Conditions:\n");
 	text = wstrappend(text, weather->text);
 	text = wstrappend(text, ", ");

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmforecast.git



More information about the Pkg-wmaker-commits mailing list