Fix error that makes class init fail on machines with UTC as time zone
For a more universal solution, the default values for a GsweTimestamp are set according to the current UTC time, with time zone also set to UTC.
This commit is contained in:
parent
8dd6eedb88
commit
8adfd0b966
@ -94,8 +94,7 @@ static void
|
|||||||
gswe_timestamp_class_init(GsweTimestampClass *klass)
|
gswe_timestamp_class_init(GsweTimestampClass *klass)
|
||||||
{
|
{
|
||||||
GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
|
GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
|
||||||
GDateTime *local_time = g_date_time_new_now_local();
|
GDateTime *local_time = g_date_time_new_now_utc();
|
||||||
GTimeZone *local_timezone = g_time_zone_new_local();
|
|
||||||
|
|
||||||
g_type_class_add_private(klass, sizeof(GsweTimestampPrivate));
|
g_type_class_add_private(klass, sizeof(GsweTimestampPrivate));
|
||||||
|
|
||||||
@ -186,7 +185,18 @@ gswe_timestamp_class_init(GsweTimestampClass *klass)
|
|||||||
*
|
*
|
||||||
* The time zone offset in hours, relative to UTC
|
* The time zone offset in hours, relative to UTC
|
||||||
*/
|
*/
|
||||||
g_object_class_install_property(gobject_class, PROP_GREGORIAN_TIMEZONE_OFFSET, g_param_spec_double("gregorian-timezone-offset", "Gregorian timezone offset", "The offset relative to UTC in the Gregorian calendar", -24.0, 24.0, g_time_zone_get_offset(local_timezone, 1) / 3600.0, G_PARAM_CONSTRUCT | G_PARAM_READWRITE));
|
g_object_class_install_property(
|
||||||
|
gobject_class,
|
||||||
|
PROP_GREGORIAN_TIMEZONE_OFFSET,
|
||||||
|
g_param_spec_double(
|
||||||
|
"gregorian-timezone-offset",
|
||||||
|
"Gregorian timezone offset",
|
||||||
|
"The offset relative to UTC in the Gregorian calendar",
|
||||||
|
-24.0, 24.0,
|
||||||
|
0.0,
|
||||||
|
G_PARAM_CONSTRUCT | G_PARAM_READWRITE
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GsweTimestamp:julian-day-valid:
|
* GsweTimestamp:julian-day-valid:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user