diff --git a/src/backend/xml/sixtp-dom-generators.c b/src/backend/xml/sixtp-dom-generators.c index 621769779b..48311ef8dc 100644 --- a/src/backend/xml/sixtp-dom-generators.c +++ b/src/backend/xml/sixtp-dom-generators.c @@ -131,17 +131,10 @@ commodity_ref_to_dom_tree(const char *tag, const gnc_commodity *c) * but we want to serialize it un-normalized, so we make a partial * copy. */ -gchar * +char * timespec_sec_to_string(const Timespec *ts) { - gchar *time_string; - GDateTime *gdt; - Timespec sts = { ts->tv_sec, 0}; - gdt = gnc_g_date_time_new_from_timespec_local (sts); - g_return_val_if_fail (gdt != NULL, NULL); - time_string = g_date_time_format (gdt, "%Y-%m-%d %H:%M:%S %z"); - g_date_time_unref (gdt); - return time_string; + return gnc_print_time64(ts->tv_sec, "%Y-%m-%d %H:%M:%S %z"); } gchar * diff --git a/src/core-utils/gnc-gdate-utils.c b/src/core-utils/gnc-gdate-utils.c index 059275aa0d..ae415fd358 100644 --- a/src/core-utils/gnc-gdate-utils.c +++ b/src/core-utils/gnc-gdate-utils.c @@ -37,11 +37,10 @@ gnc_gdate_set_today (GDate* gd) void gnc_gdate_set_time64 (GDate* gd, time64 time) { - GDateTime *gdt = gnc_g_date_time_new_from_unix_local (time); - gint y, m, d; - g_date_time_get_ymd (gdt, &y, &m, &d); - g_date_set_dmy (gd, d, m, y); - g_date_time_unref (gdt); + struct tm tm; + gnc_localtime_r(&time, &tm); + g_date_set_dmy (gd, tm.tm_mday, tm.tm_mon, tm.tm_year + 1900); + } gboolean diff --git a/src/gnome-utils/gnc-main-window.c b/src/gnome-utils/gnc-main-window.c index e17b56cc4f..e028e78220 100644 --- a/src/gnome-utils/gnc-main-window.c +++ b/src/gnome-utils/gnc-main-window.c @@ -1653,10 +1653,6 @@ static gchar *generate_statusbar_lastmodified_message() int r = stat(filepath, &statbuf); if (r == 0) { - // File mtime could be accessed ok - gint64 mtime = statbuf.st_mtime; - GDateTime *gdt = gnc_g_date_time_new_from_unix_local (mtime); - gchar *dummy_strftime_has_ampm = g_date_time_format (gdt, "%P"); /* Translators: This is the date and time that is shown in the status bar after opening a file: The date and time of last modification. The string is the format string for @@ -1664,20 +1660,14 @@ static gchar *generate_statusbar_lastmodified_message() explanation of the modifiers. First string is for a locale that has the a.m. or p.m. string in its locale, second string is for locales that do not have that string. */ - gchar *time_string = - g_date_time_format (gdt, (dummy_strftime_has_ampm && - strlen(dummy_strftime_has_ampm) > 0) - ? _("Last modified on %a, %b %e, %Y at %I:%M%P") - : _("Last modified on %x %X")); - - g_date_time_unref (gdt); - + char *time_string = + gnc_print_time64(statbuf.st_mtime, + _("Last modified on %a, %b %e, %Y at %I:%M%P")); //g_warning("got time %ld, str=%s\n", mtime, time_string); /* Translators: This message appears in the status bar after opening the file. */ message = g_strdup_printf(_("File %s opened. %s"), filename, time_string); - g_free(time_string); - g_free(dummy_strftime_has_ampm); + free(time_string); } else {