Fix compilation error on Windows

Not allowed to mix declarations and code in ISO C90...
This commit is contained in:
Geert Janssens
2014-02-18 18:59:54 +01:00
parent 0c7c335602
commit 80cd6d7238

View File

@@ -105,19 +105,22 @@ gnc_g_time_zone_new_local (void)
{
static GTimeZone* tz = NULL;
if (tz)
return tz;
return tz;
#ifndef G_OS_WIN32
tz = g_time_zone_new_local();
return tz;
#else
TIME_ZONE_INFORMATION tzinfo;
gint64 dst = GetTimeZoneInformation (&tzinfo);
gint bias = tzinfo.Bias + tzinfo.StandardBias;
gint hours = -bias / 60; // 60 minutes per hour
gint minutes = (bias < 0 ? -bias : bias) % 60;
gchar *tzstr = g_strdup_printf ("%+03d:%02d", hours, minutes);
tz = g_time_zone_new(tzstr);
g_free (tzstr); return tz;
{
TIME_ZONE_INFORMATION tzinfo;
gint64 dst = GetTimeZoneInformation (&tzinfo);
gint bias = tzinfo.Bias + tzinfo.StandardBias;
gint hours = -bias / 60; // 60 minutes per hour
gint minutes = (bias < 0 ? -bias : bias) % 60;
gchar *tzstr = g_strdup_printf ("%+03d:%02d", hours, minutes);
tz = g_time_zone_new(tzstr);
g_free (tzstr);
}
return tz;
#endif
}