char * gnc_timespec_to_iso8601_buff (Timespec ts, char * buff) { gchar *fmt1 = "%Y-%m-%d %H:%M", *fmt2 = "%s:%02d.%06d %s"; GDateTime *gdt; gchar *time_base, *tz; g_return_val_if_fail (buff != NULL, NULL); gdt = gnc_g_date_time_new_from_timespec_local (ts); g_return_val_if_fail (gdt != NULL, NULL); time_base = g_date_time_format (gdt, fmt1); #ifdef G_OS_WIN32 tz = g_date_time_format (gdt, "%Z"); #else tz = g_date_time_format (gdt, "%z"); #endif snprintf (buff, MAX_DATE_LENGTH, fmt2, time_base, g_date_time_get_second (gdt), g_date_time_get_microsecond (gdt), tz); g_free (time_base); g_free (tz); g_date_time_unref (gdt); return buff + strlen (buff); }
static void mnb_statusbar_init (MnbStatusbar *self) { MnbStatusbarPrivate *priv; GDateTime *datetime; priv = self->priv = STATUSBAR_PRIVATE (self); g_signal_connect (self, "event", G_CALLBACK (mnb_statusbar_event_cb), NULL); priv->datetime = mx_button_new (); clutter_actor_set_name (priv->datetime, "statusbar-date-button"); clutter_actor_set_parent (priv->datetime, CLUTTER_ACTOR (self)); mnb_statusbar_update_datetime (self); datetime = g_date_time_new_now_local (); g_timeout_add_seconds (60 - g_date_time_get_second (datetime), (GSourceFunc) mnb_statusbar_initial_timeout_cb, self); g_date_time_unref (datetime); }
gdouble gsd_night_light_frac_day_from_dt (GDateTime *dt) { return g_date_time_get_hour (dt) + (gdouble) g_date_time_get_minute (dt) / 60.f + (gdouble) g_date_time_get_second (dt) / 3600.f; }
static void _tgenmain_log(GLogLevelFlags level, const gchar* fileName, const gint lineNum, const gchar* functionName, const gchar* format, ...) { if(level > tgenLogFilterLevel) { return; } va_list vargs; va_start(vargs, format); gchar* fileStr = fileName ? g_path_get_basename(fileName) : g_strdup("n/a"); const gchar* functionStr = functionName ? functionName : "n/a"; GDateTime* dt = g_date_time_new_now_local(); GString* newformat = g_string_new(NULL); g_string_append_printf(newformat, "%04i-%02i-%02i %02i:%02i:%02i %"G_GINT64_FORMAT".%06i [%s] [%s:%i] [%s] %s", g_date_time_get_year(dt), g_date_time_get_month(dt), g_date_time_get_day_of_month(dt), g_date_time_get_hour(dt), g_date_time_get_minute(dt), g_date_time_get_second(dt), g_date_time_to_unix(dt), g_date_time_get_microsecond(dt), _tgenmain_logLevelToString(level), fileStr, lineNum, functionName, format); gchar* message = g_strdup_vprintf(newformat->str, vargs); g_print("%s\n", message); g_free(message); g_string_free(newformat, TRUE); g_date_time_unref(dt); g_free(fileStr); va_end(vargs); }
gchar* balde_datetime_logging(GDateTime *dt) { return g_strdup_printf("%02d/%s/%04d %02d:%02d:%02d", g_date_time_get_day_of_month(dt), months[g_date_time_get_month(dt) - 1], g_date_time_get_year(dt), g_date_time_get_hour(dt), g_date_time_get_minute(dt), g_date_time_get_second(dt)); }
/** * gst_date_time_get_second: * @datetime: a #GstDateTime * * Retrieves the second of the minute represented by @datetime in the gregorian * calendar. * Call gst_date_time_has_time() before, to avoid warnings. * * Return value: the second represented by @datetime */ gint gst_date_time_get_second (const GstDateTime * datetime) { g_return_val_if_fail (datetime != NULL, 0); g_return_val_if_fail (gst_date_time_has_second (datetime), 0); return g_date_time_get_second (datetime->datetime); }
gchar* balde_datetime_rfc5322(GDateTime *dt) { // datetime must be utc return g_strdup_printf("%s, %02d %s %04d %02d:%02d:%02d GMT", days[g_date_time_get_day_of_week(dt) - 1], g_date_time_get_day_of_month(dt), months[g_date_time_get_month(dt) - 1], g_date_time_get_year(dt), g_date_time_get_hour(dt), g_date_time_get_minute(dt), g_date_time_get_second(dt)); }
/* Get current time and copy to src. */ void time_get_now (gchar *src) { GDateTime *time; gint hr, mi, se; time = g_date_time_new_now_local (); hr = g_date_time_get_hour (time); mi = g_date_time_get_minute (time); se = g_date_time_get_second (time); g_sprintf (src, "%.2d:%.2d:%.2d: ", hr, mi, se); }
static void gnc_g_date_time_fill_struct_tm (GDateTime *gdt, struct tm* time) { g_date_time_get_ymd (gdt, &(time->tm_year), &(time->tm_mon), &(time->tm_mday)); time->tm_sec = g_date_time_get_second (gdt); time->tm_min = g_date_time_get_minute (gdt); time->tm_hour = g_date_time_get_hour (gdt); // Watch out: struct tm has wday=0..6 with Sunday=0, but GDateTime has wday=1..7 with Sunday=7. time->tm_wday = g_date_time_get_day_of_week (gdt) % 7; time->tm_yday = g_date_time_get_day_of_year (gdt); time->tm_isdst = g_date_time_is_daylight_savings (gdt); time->tm_year -= 1900; --time->tm_mon; }
GSList * chat_log_get_previous(const gchar * const login, const gchar * const recipient, GSList *history) { GTimeZone *tz = g_time_zone_new_local(); GDateTime *now = g_date_time_new_now_local(); GDateTime *log_date = g_date_time_new(tz, g_date_time_get_year(session_started), g_date_time_get_month(session_started), g_date_time_get_day_of_month(session_started), g_date_time_get_hour(session_started), g_date_time_get_minute(session_started), g_date_time_get_second(session_started)); // get data from all logs from the day the session was started to today while (g_date_time_compare(log_date, now) != 1) { char *filename = _get_log_filename(recipient, login, log_date, FALSE); FILE *logp = fopen(filename, "r"); char *line; if (logp != NULL) { GString *gs_header = g_string_new(""); g_string_append_printf(gs_header, "%d/%d/%d:", g_date_time_get_day_of_month(log_date), g_date_time_get_month(log_date), g_date_time_get_year(log_date)); char *header = strdup(gs_header->str); history = g_slist_append(history, header); g_string_free(gs_header, TRUE); while ((line = prof_getline(logp)) != NULL) { history = g_slist_append(history, line); } fclose(logp); } free(filename); GDateTime *next = g_date_time_add_days(log_date, 1); g_date_time_unref(log_date); log_date = g_date_time_ref(next); } g_time_zone_unref(tz); return history; }
static gboolean update_clock (gpointer data) { GnomeWallClock *self = data; GDesktopClockFormat clock_format; gboolean show_full_date; gboolean show_weekday; gboolean show_seconds; GSource *source; GDateTime *now; GDateTime *expiry; clock_format = g_settings_get_enum (self->priv->desktop_settings, "clock-format"); show_weekday = !self->priv->time_only && g_settings_get_boolean (self->priv->desktop_settings, "clock-show-weekday"); show_full_date = !self->priv->time_only && g_settings_get_boolean (self->priv->desktop_settings, "clock-show-date"); show_seconds = g_settings_get_boolean (self->priv->desktop_settings, "clock-show-seconds"); now = g_date_time_new_now (self->priv->timezone); if (show_seconds) expiry = g_date_time_add_seconds (now, 1); else expiry = g_date_time_add_seconds (now, 60 - g_date_time_get_second (now)); if (self->priv->clock_update_id) g_source_remove (self->priv->clock_update_id); source = _gnome_datetime_source_new (now, expiry, TRUE); g_source_set_priority (source, G_PRIORITY_HIGH); g_source_set_callback (source, update_clock, self, NULL); self->priv->clock_update_id = g_source_attach (source, NULL); g_source_unref (source); g_free (self->priv->clock_string); self->priv->clock_string = gnome_wall_clock_string_for_datetime (self, now, clock_format, show_weekday, show_full_date, show_seconds); g_date_time_unref (now); g_date_time_unref (expiry); g_object_notify ((GObject*)self, "clock"); return FALSE; }
static void _pcapmain_log(GLogLevelFlags level, const gchar* functionName, const gchar* format, ...) { va_list vargs; va_start(vargs, format); GDateTime* dt = g_date_time_new_now_local(); GString* newformat = g_string_new(NULL); g_string_append_printf(newformat, "%04i-%02i-%02i %02i:%02i:%02i %"G_GINT64_FORMAT".%06i [%s] [%s] %s", g_date_time_get_year(dt), g_date_time_get_month(dt), g_date_time_get_day_of_month(dt), g_date_time_get_hour(dt), g_date_time_get_minute(dt), g_date_time_get_second(dt), g_date_time_to_unix(dt), g_date_time_get_microsecond(dt), _pcapmain_logLevelToString(level), functionName, format); g_logv(PCAP_LOG_DOMAIN, level, newformat->str, vargs); g_string_free(newformat, TRUE); g_date_time_unref(dt); va_end(vargs); }
static gchar* plank_services_logger_get_time (void) { gchar* result = NULL; GDateTime* now = NULL; GDateTime* _tmp0_ = NULL; gint _tmp1_ = 0; gint _tmp2_ = 0; gint _tmp3_ = 0; gint _tmp4_ = 0; gchar* _tmp5_ = NULL; _tmp0_ = g_date_time_new_now_local (); now = _tmp0_; _tmp1_ = g_date_time_get_hour (now); _tmp2_ = g_date_time_get_minute (now); _tmp3_ = g_date_time_get_second (now); _tmp4_ = g_date_time_get_microsecond (now); _tmp5_ = g_strdup_printf ("%.2d:%.2d:%.2d.%.6d", _tmp1_, _tmp2_, _tmp3_, _tmp4_); result = _tmp5_; _g_date_time_unref0 (now); return result; }
static void change_date (CcDateTimePanel *self) { CcDateTimePanelPrivate *priv = self->priv; guint mon, y, d; GDateTime *old_date; old_date = priv->date; mon = 1 + gtk_combo_box_get_active (GTK_COMBO_BOX (W ("month-combobox"))); y = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (W ("year-spinbutton"))); d = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (W ("day-spinbutton"))); priv->date = g_date_time_new_local (y, mon, d, g_date_time_get_hour (old_date), g_date_time_get_minute (old_date), g_date_time_get_second (old_date)); g_date_time_unref (old_date); queue_set_datetime (self); }
static gboolean redisplay_clock (gpointer data) { GSource *source; GDateTime *now, *expiry; now = g_date_time_new_now_local (); g_print ("%02d:%02d\n", g_date_time_get_hour (now), g_date_time_get_minute (now)); expiry = g_date_time_add_seconds (now, 60 - g_date_time_get_second (now)); source = g_date_time_source_new (expiry, TRUE); g_source_set_callback (source, redisplay_clock, NULL, NULL); g_source_attach (source, NULL); g_source_unref (source); g_date_time_unref (expiry); g_date_time_unref (now); return FALSE; }
static void change_time (CcDateTimePanel *panel) { CcDateTimePanelPrivate *priv = panel->priv; guint h, m; GDateTime *old_date; old_date = priv->date; h = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (W ("h_spinbutton"))); m = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (W ("m_spinbutton"))); if (priv->clock_format == G_DESKTOP_CLOCK_FORMAT_12H) { gboolean is_pm_time; GtkWidget *visible_child; visible_child = gtk_stack_get_visible_child (GTK_STACK (priv->am_pm_stack)); if (visible_child == priv->pm_label) is_pm_time = TRUE; else is_pm_time = FALSE; if (h == 12) h = 0; if (is_pm_time) h += 12; } priv->date = g_date_time_new_local (g_date_time_get_year (old_date), g_date_time_get_month (old_date), g_date_time_get_day_of_month (old_date), h, m, g_date_time_get_second (old_date)); g_date_time_unref (old_date); update_time (panel); queue_set_datetime (panel); }
static gboolean update_clock (gpointer data) { GnomeWallClock *self = data; const char *format_string; GSource *source; GDateTime *now; GDateTime *expiry; now = g_date_time_new_now_local (); expiry = g_date_time_add_seconds (now, 60 - g_date_time_get_second (now)); if (self->priv->clock_update_id) g_source_remove (self->priv->clock_update_id); source = _gnome_datetime_source_new (now, expiry, TRUE); g_source_set_priority (source, G_PRIORITY_HIGH); g_source_set_callback (source, update_clock, self, NULL); self->priv->clock_update_id = g_source_attach (source, NULL); g_source_unref (source); format_string = g_strdup_printf ( "<b><span font_desc=\"Ubuntu 64\" foreground=\"#FFFFFF\">%s</span></b>\n<b><span font_desc=\"Ubuntu 24\" foreground=\"#FFFFFF\">%s</span></b>", _("%R"), _("%A, %B %e")); g_free (self->priv->clock_string); self->priv->clock_string = g_date_time_format (now, format_string); g_date_time_unref (now); g_date_time_unref (expiry); g_object_notify ((GObject*)self, "clock"); return FALSE; }
static char *formatLogMessage(const char *file, int line, ShovelerLogLevel level, const char *message) { const char *strippedLocation = strstr(file, logLocationPrefix); if(strippedLocation != NULL) { strippedLocation += strlen(logLocationPrefix); } else { strippedLocation = file; } GDateTime *now = g_date_time_new_now_local(); GString *result = g_string_new(""); g_string_append_printf(result, "[%02d:%02d:%02d] (%s:%s:%d) %s", g_date_time_get_hour(now), g_date_time_get_minute(now), g_date_time_get_second(now), getStaticLogLevelName(level), strippedLocation, line, message); g_date_time_unref(now); return g_string_free(result, false); }
static gint g_calendar_gregorian_real_get_second (GCalendar *calendar, /* IN */ GDateTime *datetime) /* IN */ { return g_date_time_get_second (datetime); }
BerValue * gda_ldap_attr_g_value_to_value (LdapConnectionData *cdata, const GValue *cvalue) { BerValue *bv; if (!cvalue) return NULL; bv = g_new (struct berval, 1); if (G_VALUE_TYPE (cvalue) == G_TYPE_STRING) { const gchar *cstr; cstr = g_value_get_string (cvalue); bv->bv_val = g_strdup (cstr); bv->bv_len = strlen (cstr); } else if (G_VALUE_TYPE (cvalue) == G_TYPE_DATE_TIME) { GDateTime *ts; gchar *str; ts = g_value_get_boxed (cvalue); if (g_date_time_get_second (ts) == (gint) g_date_time_get_seconds (ts)) { if (g_date_time_get_utc_offset (ts) == 0) str = g_strdup_printf ("%04d-%02d-%02dT%02d:%02d:%02d", g_date_time_get_year (ts), g_date_time_get_month (ts), g_date_time_get_day_of_month (ts), g_date_time_get_hour (ts), g_date_time_get_minute (ts), g_date_time_get_second (ts)); else { str = g_strdup_printf ("%04d-%02d-%02dT%02d:%02d:%02d", g_date_time_get_year (ts), g_date_time_get_month (ts), g_date_time_get_day_of_month (ts), g_date_time_get_hour (ts), g_date_time_get_minute (ts), g_date_time_get_second (ts)); TO_IMPLEMENT; } } else { if (g_date_time_get_utc_offset (ts) == 0) str = g_strdup_printf ("%04d-%02d-%02dT%02d:%02d:%02d,%lu", g_date_time_get_year (ts), g_date_time_get_month (ts), g_date_time_get_day_of_month (ts), g_date_time_get_hour (ts), g_date_time_get_minute (ts), g_date_time_get_second (ts), (gulong) ((g_date_time_get_seconds (ts) - g_date_time_get_second (ts)) * 1000000.0)); else { str = g_strdup_printf ("%04d-%02d-%02dT%02d:%02d:%02d,%lu", g_date_time_get_year (ts), g_date_time_get_month (ts), g_date_time_get_day_of_month (ts), g_date_time_get_hour (ts), g_date_time_get_minute (ts), g_date_time_get_second (ts), (gulong) ((g_date_time_get_seconds (ts) - g_date_time_get_second (ts)) * 1000000.0)); TO_IMPLEMENT; } } bv->bv_val = str; bv->bv_len = strlen (str); } else if (G_VALUE_TYPE (cvalue) == G_TYPE_DATE) { GDate *date; gchar *str; date = (GDate*) g_value_get_boxed (cvalue); str = g_strdup_printf ("%04d-%02d-%02d", g_date_get_year (date), g_date_get_month (date), g_date_get_day (date)); bv->bv_val = str; bv->bv_len = strlen (str); } else if (G_VALUE_TYPE (cvalue) == GDA_TYPE_NULL) { bv->bv_val = NULL; bv->bv_len = 0; } else if (G_VALUE_TYPE (cvalue) == GDA_TYPE_BINARY) { TO_IMPLEMENT; } else if (G_VALUE_TYPE (cvalue) == GDA_TYPE_BLOB) { TO_IMPLEMENT; } else { gchar *str; str = gda_value_stringify (cvalue); bv->bv_val = str; bv->bv_len = strlen (str); } return bv; }
gint gst_date_time_get_second (const GstDateTime * datetime) { return g_date_time_get_second (datetime->datetime); }
static gboolean update_clock (gpointer data) { GnomeWallClock *self = data; CDesktopClockFormat clock_format; const char *format_string; gboolean show_full_date; gboolean show_weekday; gboolean show_seconds; GSource *source; GDateTime *now; GDateTime *expiry; clock_format = g_settings_get_enum (self->priv->desktop_settings, "clock-format"); show_weekday = !self->priv->time_only; show_full_date = show_weekday && g_settings_get_boolean (self->priv->desktop_settings, "clock-show-date"); show_seconds = g_settings_get_boolean (self->priv->desktop_settings, "clock-show-seconds"); now = g_date_time_new_now_local (); if (show_seconds) expiry = g_date_time_add_seconds (now, 1); else expiry = g_date_time_add_seconds (now, 60 - g_date_time_get_second (now)); if (self->priv->clock_update_id) g_source_remove (self->priv->clock_update_id); source = _gnome_datetime_source_new (now, expiry, TRUE); g_source_set_priority (source, G_PRIORITY_HIGH); g_source_set_callback (source, update_clock, self, NULL); self->priv->clock_update_id = g_source_attach (source, NULL); g_source_unref (source); if (clock_format == C_DESKTOP_CLOCK_FORMAT_24H) { if (show_full_date) { /* Translators: This is the time format with full date used in 24-hour mode. */ format_string = show_seconds ? _("%a %b %e, %R:%S") : _("%a %b %e, %R"); } else if (show_weekday) { /* Translators: This is the time format with day used in 24-hour mode. */ format_string = show_seconds ? _("%a %R:%S") : _("%a %R"); } else { /* Translators: This is the time format without date used in 24-hour mode. */ format_string = show_seconds ? _("%R:%S") : _("%R"); } } else { if (show_full_date) { /* Translators: This is a time format with full date used for AM/PM. */ format_string = show_seconds ? _("%a %b %e, %l:%M:%S %p") : _("%a %b %e, %l:%M %p"); } else if (show_weekday) { /* Translators: This is a time format with day used for AM/PM. */ format_string = show_seconds ? _("%a %l:%M:%S %p") : _("%a %l:%M %p"); } else { /* Translators: This is a time format without date used for AM/PM. */ format_string = show_seconds ? _("%l:%M:%S %p") : _("%l:%M %p"); } } g_free (self->priv->clock_string); self->priv->clock_string = g_date_time_format (now, format_string); g_date_time_unref (now); g_date_time_unref (expiry); g_object_notify ((GObject*)self, "clock"); return FALSE; }
/** * vik_datetime_edit_dialog: * @parent: The parent window * @title: The title to use for the dialog * @initial_time: The inital date/time to be shown * @tz: The #GTimeZone this dialog will operate in * * Returns: A time selected by the user via this dialog * Even though a time of zero is notionally valid - consider it unlikely to be actually wanted! * Thus if the time is zero then the dialog was cancelled or somehow an invalid date was encountered. */ time_t vik_datetime_edit_dialog ( GtkWindow *parent, const gchar *title, time_t initial_time, GTimeZone *tz ) { g_return_val_if_fail ( tz, 0 ); GtkWidget *dialog = gtk_dialog_new_with_buttons ( title, parent, GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL ); gtk_dialog_set_default_response ( GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT ); GtkWidget *response_w = NULL; #if GTK_CHECK_VERSION (2, 20, 0) response_w = gtk_dialog_get_widget_for_response ( GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT ); #endif GtkWidget *label; GtkWidget *cal = gtk_calendar_new (); // Set according to the given date/time + timezone for display GDateTime *gdt_in = g_date_time_new_from_unix_utc ( (gint64)initial_time ); GDateTime *gdt_tz = g_date_time_to_timezone ( gdt_in, tz ); g_date_time_unref ( gdt_in ); gtk_calendar_select_month ( GTK_CALENDAR(cal), g_date_time_get_month(gdt_tz)-1, g_date_time_get_year (gdt_tz) ); gtk_calendar_select_day ( GTK_CALENDAR(cal), g_date_time_get_day_of_month(gdt_tz) ); GtkWidget *hbox_time = gtk_hbox_new ( FALSE, 1 ); label = gtk_label_new ( g_date_time_get_timezone_abbreviation(gdt_tz) ); gtk_box_pack_start ( GTK_BOX(hbox_time), label, FALSE, FALSE, 5 ); GtkWidget *sb_hours = gtk_spin_button_new_with_range ( 0.0, 23.0, 1.0 ); gtk_box_pack_start ( GTK_BOX(hbox_time), sb_hours, FALSE, FALSE, 0 ); gtk_spin_button_set_value ( GTK_SPIN_BUTTON(sb_hours), g_date_time_get_hour(gdt_tz) ); g_signal_connect ( sb_hours, "output", G_CALLBACK(on_output), NULL ); label = gtk_label_new ( ":" ); gtk_box_pack_start ( GTK_BOX(hbox_time), label, FALSE, FALSE, 0 ); GtkWidget *sb_minutes = gtk_spin_button_new_with_range ( 0.0, 59.0, 1.0 ); gtk_box_pack_start ( GTK_BOX(hbox_time), sb_minutes, FALSE, FALSE, 0); gtk_spin_button_set_value ( GTK_SPIN_BUTTON(sb_minutes), g_date_time_get_minute(gdt_tz) ); g_signal_connect ( sb_minutes, "output", G_CALLBACK(on_output), NULL ); label = gtk_label_new ( ":" ); gtk_box_pack_start(GTK_BOX(hbox_time), label, FALSE, FALSE, 0); GtkWidget *sb_seconds = gtk_spin_button_new_with_range ( 0.0, 59.0, 1.0 ); gtk_box_pack_start ( GTK_BOX(hbox_time), sb_seconds, FALSE, FALSE, 0 ); gtk_spin_button_set_value ( GTK_SPIN_BUTTON(sb_seconds), g_date_time_get_second(gdt_tz) ); g_signal_connect ( sb_seconds, "output", G_CALLBACK(on_output), NULL ); gtk_box_pack_start ( GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), cal, FALSE, FALSE, 0 ); gtk_box_pack_start ( GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), hbox_time, FALSE, FALSE, 5 ); if ( response_w ) gtk_widget_grab_focus ( response_w ); g_date_time_unref ( gdt_tz ); gtk_widget_show_all ( dialog ); if ( gtk_dialog_run ( GTK_DIALOG(dialog) ) != GTK_RESPONSE_ACCEPT ) { gtk_widget_destroy ( dialog ); return 0; } // Read values guint year = 0; guint month = 0; guint day = 0; guint hours = 0; guint minutes = 0; guint seconds = 0; gtk_calendar_get_date ( GTK_CALENDAR(cal), &year, &month, &day ); hours = gtk_spin_button_get_value_as_int ( GTK_SPIN_BUTTON(sb_hours) ); minutes = gtk_spin_button_get_value_as_int ( GTK_SPIN_BUTTON(sb_minutes) ); seconds = gtk_spin_button_get_value_as_int ( GTK_SPIN_BUTTON(sb_seconds) ); gtk_widget_destroy(dialog); time_t ans = initial_time; GDateTime *gdt_ans = g_date_time_new ( tz, year, month+1, day, hours, minutes, (gdouble)seconds ); if ( gdt_ans ) { ans = g_date_time_to_unix ( gdt_ans ); g_date_time_unref ( gdt_ans ); } return ans; }