blob: 14e1c88d96d3242fdce83c71aaf64c58d2ebeb1e [file] [log] [blame] [edit]
--- ./libgweather/weather-iwin.c.orig 2014-09-07 17:25:15.852668400 +0200
+++ ./libgweather/weather-iwin.c 2014-09-07 17:26:07.678605100 +0200
@@ -364,7 +364,14 @@
gchar latstr[G_ASCII_DTOSTR_BUF_SIZE], lonstr[G_ASCII_DTOSTR_BUF_SIZE];
now = time (NULL);
+#ifndef G_OS_WIN32
localtime_r (&now, &tm);
+#else
+ GDate *gdate = g_date_new ();
+ g_date_set_time_t (gdate, now);
+ g_date_to_struct_tm (gdate, &tm);
+ g_date_free (gdate);
+#endif
g_ascii_dtostr (latstr, sizeof(latstr), RADIANS_TO_DEGREES (loc->latitude));
g_ascii_dtostr (lonstr, sizeof(lonstr), RADIANS_TO_DEGREES (loc->longitude));
--- ./libgweather/weather-metar.c.orig 2014-09-07 17:23:43.223452300 +0200
+++ ./libgweather/weather-metar.c 2014-09-07 17:25:51.173668900 +0200
@@ -47,7 +47,14 @@
const time_t now = time (NULL);
struct tm tm;
+#ifndef G_OS_WIN32
localtime_r (&now, &tm);
+#else
+ GDate *gdate = g_date_new ();
+ g_date_set_time_t (gdate, now);
+ g_date_to_struct_tm (gdate, &tm);
+ g_date_free (gdate);
+#endif
/* If last reading took place just before midnight UTC on the
* first, adjust the date downward to allow for the month
--- ./libgweather/weather-owm.c.orig 2014-03-08 19:38:42.000000000 +0100
+++ ./libgweather/weather-owm.c 2014-09-07 17:58:20.405807600 +0200
@@ -29,7 +29,6 @@
#include <math.h>
#include <time.h>
#include <unistd.h>
-#include <langinfo.h>
#include <libxml/parser.h>
#include <libxml/xpath.h>
@@ -38,6 +37,10 @@
#define GWEATHER_I_KNOW_THIS_IS_UNSTABLE
#include "weather-priv.h"
+#ifndef G_OS_WIN32
+#include <langinfo.h>
+#endif
+
#define XC(t) ((const xmlChar *)(t))
/* Reference for symbols at http://bugs.openweathermap.org/projects/api/wiki/Weather_Condition_Codes */
@@ -133,16 +136,39 @@
GTimeZone *tz;
GDateTime *dt;
time_t rval;
- char *after;
-
- after = strptime ((const char*) str, "%Y-%m-%dT%T", &time);
- if (after == NULL) {
- g_warning ("Cannot parse date string \"%s\"", str);
- return 0;
- }
- if (*after == 'Z')
- tzid = "UTC";
+#ifndef G_OS_WIN32
+ char *after;
+ after = strptime ((const char*) str, "%Y-%m-%dT%T", &time);
+ if (after == NULL) {
+ g_warning ("Cannot parse date string \"%s\"", str);
+ return 0;
+ }
+ if (*after == 'Z')
+ tzid = "UTC";
+#else
+ int year;
+ int mon;
+ int mday;
+ int hour;
+ int min;
+ int sec;
+ char *gctz;
+ int parsed = scanf ((const char*) str, "%d-%d-%dT%d:%d:%d%s",
+ &year, &mon, &mday, &hour, &min, &sec, &gctz);
+ if (parsed != 7) {
+ g_warning ("Cannot parse date string \"%s\"", str);
+ return 0;
+ }
+ time.tm_year = year + 1900;
+ time.tm_mon = mon + 1;
+ time.tm_mday = mday;
+ time.tm_hour = hour;
+ time.tm_min = min;
+ time.tm_sec = sec;
+ if (*gctz == 'Z')
+ tzid = "UTC";
+#endif
tz = g_time_zone_new (tzid);
dt = g_date_time_new (tz,
--- ./libgweather/weather-sun.c.orig 2014-09-07 17:53:39.134081200 +0200
+++ ./libgweather/weather-sun.c 2014-09-07 17:54:30.044591900 +0200
@@ -322,7 +322,14 @@
_gweather_info_ensure_sun (info);
/* Determine when the next local midnight occurs */
+#ifndef G_OS_WIN32
(void) localtime_r (&now, &ltm);
+#else
+ GDate *gdate = g_date_new ();
+ g_date_set_time_t (gdate, now);
+ g_date_to_struct_tm (gdate, &ltm);
+ g_date_free (gdate);
+#endif
ltm.tm_sec = 0;
ltm.tm_min = 0;
ltm.tm_hour = 0;
--- ./libgweather/weather-yrno.c.orig 2014-09-07 17:34:08.504436200 +0200
+++ ./libgweather/weather-yrno.c 2014-09-07 17:58:24.358807100 +0200
@@ -94,16 +94,39 @@
GTimeZone *tz;
GDateTime *dt;
time_t rval;
- char *after;
- after = strptime ((const char*) str, "%Y-%m-%dT%T", &time);
- if (after == NULL) {
- g_warning ("Cannot parse date string \"%s\"", str);
- return 0;
- }
-
- if (*after == 'Z')
- tzid = "UTC";
+#ifndef G_OS_WIN32
+ char *after;
+ after = strptime ((const char*) str, "%Y-%m-%dT%T", &time);
+ if (after == NULL) {
+ g_warning ("Cannot parse date string \"%s\"", str);
+ return 0;
+ }
+ if (*after == 'Z')
+ tzid = "UTC";
+#else
+ int year;
+ int mon;
+ int mday;
+ int hour;
+ int min;
+ int sec;
+ char *gctz;
+ int parsed = scanf ((const char*) str, "%d-%d-%dT%d:%d:%d%s",
+ &year, &mon, &mday, &hour, &min, &sec, &gctz);
+ if (parsed != 7) {
+ g_warning ("Cannot parse date string \"%s\"", str);
+ return 0;
+ }
+ time.tm_year = year + 1900;
+ time.tm_mon = mon + 1;
+ time.tm_mday = mday;
+ time.tm_hour = hour;
+ time.tm_min = min;
+ time.tm_sec = sec;
+ if (*gctz == 'Z')
+ tzid = "UTC";
+#endif
tz = g_time_zone_new (tzid);
dt = g_date_time_new (tz,
--- ./libgweather/gweather-weather.c.orig 2014-09-07 17:18:05.621641500 +0200
+++ ./libgweather/gweather-weather.c 2014-09-07 17:27:17.789137400 +0200
@@ -28,13 +28,16 @@
#include <math.h>
#include <time.h>
#include <unistd.h>
-#include <langinfo.h>
#include <errno.h>
#include <gtk/gtk.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <glib.h>
+#ifndef G_OS_WIN32
+#include <langinfo.h>
+#endif
+
#include "gweather-weather.h"
#include "gweather-private.h"
#include "gweather-enum-types.h"