From 64b7d2640fc91c28db3a16239f8fe5f6243bec26 Mon Sep 17 00:00:00 2001 From: rbuj Date: Tue, 30 Apr 2019 13:12:04 +0200 Subject: eel: remove date & time functions Do not need to extend glib library, since it now incorporates these functions. Extended date format modifiers are available on glib v2.56. eel-glib-extensions.h/c: GDate * eel_g_date_new_tm (struct tm *time_pieces); char * eel_strdup_strftime (const char *format, struct tm *time_pieces); gint64 eel_get_system_time (void); Do not need to test the extensions in eel_self_check_glib_extensions (void). eel-glib-extensions.c: static void check_tm_to_g_date (time_t time) static char * test_strftime (...) Do not need to check if strftime implements extended date format modifiers on the system (available on glibc v2.27). configure.ac --- src/caja-file-management-properties.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/caja-file-management-properties.c') diff --git a/src/caja-file-management-properties.c b/src/caja-file-management-properties.c index 430642e7..96b38c3a 100644 --- a/src/caja-file-management-properties.c +++ b/src/caja-file-management-properties.c @@ -508,27 +508,27 @@ create_date_format_menu (GtkBuilder *builder) { GtkComboBoxText *combo_box; gchar *date_string; - time_t now_raw; - struct tm* now; + GDateTime *now; combo_box = GTK_COMBO_BOX_TEXT (gtk_builder_get_object (builder, CAJA_FILE_MANAGEMENT_PROPERTIES_DATE_FORMAT_WIDGET)); - now_raw = time (NULL); - now = localtime (&now_raw); + now = g_date_time_new_now_local (); - date_string = eel_strdup_strftime ("%c", now); + date_string = g_date_time_format (now, "%c"); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_box), date_string); g_free (date_string); - date_string = eel_strdup_strftime ("%Y-%m-%d %H:%M:%S", now); + date_string = g_date_time_format (now, "%Y-%m-%d %H:%M:%S"); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_box), date_string); g_free (date_string); - date_string = eel_strdup_strftime (_("today at %-I:%M:%S %p"), now); + date_string = g_date_time_format (now, _("today at %-I:%M:%S %p")); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_box), date_string); g_free (date_string); + + g_date_time_unref (now); } static void -- cgit v1.2.1