diff options
author | rbuj <[email protected]> | 2020-02-04 09:54:03 +0100 |
---|---|---|
committer | raveit65 <[email protected]> | 2020-03-12 15:08:31 +0100 |
commit | 7abdbf59d51d66447b5f059761658181a53945e0 (patch) | |
tree | 13c1c8294c7ca4cac1eab74e65695183456b29c1 | |
parent | 10fe037ccc55de08f3355a4b36f974cbd2d59b92 (diff) | |
download | libmateweather-7abdbf59d51d66447b5f059761658181a53945e0.tar.bz2 libmateweather-7abdbf59d51d66447b5f059761658181a53945e0.tar.xz |
IWIN: use GDateTime for getting current date
-rw-r--r-- | libmateweather/weather-iwin.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/libmateweather/weather-iwin.c b/libmateweather/weather-iwin.c index 75a8fac..d9c91c3 100644 --- a/libmateweather/weather-iwin.c +++ b/libmateweather/weather-iwin.c @@ -427,13 +427,15 @@ iwin_start_open (WeatherInfo *info) if (info->forecast_type == FORECAST_LIST) { /* see the description here: http://www.weather.gov/forecasts/xml/ */ if (loc->latlon_valid) { - struct tm tm; - time_t now = time (NULL); + GDateTime *dt; + gint year, month, day; - localtime_r (&now, &tm); + dt = g_date_time_new_now_local (); + g_date_time_get_ymd (dt, &year, &month, &day); + g_date_time_unref (dt); url = g_strdup_printf ("http://www.weather.gov/forecasts/xml/sample_products/browser_interface/ndfdBrowserClientByDay.php?&lat=%.02f&lon=%.02f&format=24+hourly&startDate=%04d-%02d-%02d&numDays=7", - RADIANS_TO_DEGREES (loc->latitude), RADIANS_TO_DEGREES (loc->longitude), 1900 + tm.tm_year, 1 + tm.tm_mon, tm.tm_mday); + RADIANS_TO_DEGREES (loc->latitude), RADIANS_TO_DEGREES (loc->longitude), year, month, day); msg = soup_message_new ("GET", url); g_free (url); @@ -441,7 +443,6 @@ iwin_start_open (WeatherInfo *info) info->requests_pending++; } - return; } |