[libgweather/ebassi/gtk4: 9/56] Use GDateTime instead of the deprecated GTimeVal
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgweather/ebassi/gtk4: 9/56] Use GDateTime instead of the deprecated GTimeVal
- Date: Wed, 13 Oct 2021 12:02:12 +0000 (UTC)
commit e49a99d16e7e2f76ab81bf854ae4598ca2eb1f19
Author: Emmanuele Bassi <ebassi gnome org>
Date: Thu Oct 7 12:54:46 2021 +0100
Use GDateTime instead of the deprecated GTimeVal
GTimeVal is not Y2038 safe on 32 bit platforms.
libgweather/weather-iwin.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/libgweather/weather-iwin.c b/libgweather/weather-iwin.c
index d5e0aae9..6b489971 100644
--- a/libgweather/weather-iwin.c
+++ b/libgweather/weather-iwin.c
@@ -77,7 +77,7 @@ parseForecastXml (const char *buff, GWeatherInfo *original_info)
if (isElem (node, "data")) {
xmlNode *n;
char *time_layout = NULL;
- time_t update_times[7] = {0};
+ gint64 update_times[7] = {0};
for (n = node->children; n; n = n->next) {
if (!n->name)
@@ -100,10 +100,12 @@ parseForecastXml (const char *buff, GWeatherInfo *original_info)
xmlChar *val = xmlNodeGetContent (c);
if (val) {
- GTimeVal tv;
+ GDateTime *dt;
- if (g_time_val_from_iso8601 ((const char *)val, &tv)) {
- update_times[count] = tv.tv_sec;
+ dt = g_date_time_new_from_iso8601 ((const char *)val, NULL);
+ if (dt != NULL) {
+ update_times[count] = g_date_time_to_unix (dt);
+ g_date_time_unref (dt);
} else {
update_times[count] = 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]