From 5a997cb61ded06c2b26449241ca59fbdb6122e3a Mon Sep 17 00:00:00 2001 From: "Gergely POLONKAI (W00d5t0ck)" Date: Mon, 9 Sep 2013 10:10:57 +0200 Subject: [PATCH] Added method gswe_timestamp_set_gregorian_full() --- src/gswe-timestamp.c | 20 ++++++++++++++++++++ src/gswe-timestamp.h | 1 + 2 files changed, 21 insertions(+) diff --git a/src/gswe-timestamp.c b/src/gswe-timestamp.c index 19c0823..ecbd8a8 100644 --- a/src/gswe-timestamp.c +++ b/src/gswe-timestamp.c @@ -368,6 +368,26 @@ gswe_timestamp_get_instant_recalc(GsweTimestamp *timestamp) return timestamp->priv->instant_recalc; } +void +gswe_timestamp_set_gregorian_full(GsweTimestamp *timestamp, gint year, gint month, gint day, gint hour, gint minute, gint second, gint microsecond, gdouble time_zone_offset) +{ + timestamp->priv->gregorian_year = year; + timestamp->priv->gregorian_month = month; + timestamp->priv->gregorian_day = day; + timestamp->priv->gregorian_hour = hour; + timestamp->priv->gregorian_minute = minute; + timestamp->priv->gregorian_second = second; + timestamp->priv->gregorian_microsecond = microsecond; + timestamp->priv->gregorian_timezone_offset = time_zone_offset; + timestamp->priv->valid_dates = VALID_GREGORIAN; + + if (timestamp->priv->instant_recalc == TRUE) { + gswe_timestamp_calculate_all(timestamp); + } + + gswe_timestamp_emit_changed(timestamp); +} + void gswe_timestamp_set_gregorian_year(GsweTimestamp *timestamp, gint gregorian_year) { diff --git a/src/gswe-timestamp.h b/src/gswe-timestamp.h index 2161f92..1675fcd 100644 --- a/src/gswe-timestamp.h +++ b/src/gswe-timestamp.h @@ -58,6 +58,7 @@ GType gswe_timestamp_get_type(void); GsweTimestamp *gswe_timestamp_new(void); GsweTimestamp *gswe_timestamp_new_from_julian_day(gdouble julian_day); GsweTimestamp * gswe_timestamp_new_from_gregorian_full(gint year, gint month, gint day, gint hour, gint minute, gint second, gint microsecond, gdouble time_zone_offset); +void gswe_timestamp_set_gregorian_full(GsweTimestamp *timestamp, gint year, gint month, gint day, gint hour, gint minute, gint second, gint microsecond, gdouble time_zone_offset); void gswe_timestamp_set_instant_recalc(GsweTimestamp *timestamp, gboolean instant_recalc); gboolean gswe_timestamp_get_instant_recalc(GsweTimestamp *timestamp); void gswe_timestamp_set_gregorian_year(GsweTimestamp *timestamp, gint gregorian_year);