From aa689325b2247e6b7afdab9a535506d18e479606 Mon Sep 17 00:00:00 2001 From: Peter Williams Date: Mon, 13 Aug 2001 16:29:39 +0000 Subject: New function. Convert a time_t to a gchar * (with i18n) (describe_button): 2001-08-13 Peter Williams * filter-datespec.c (format_time): New function. Convert a time_t to a gchar * (with i18n) (describe_button): Use format_time instead of ctime. svn path=/trunk/; revision=11942 --- filter/ChangeLog | 2 ++ filter/filter-datespec.c | 17 +++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) (limited to 'filter') diff --git a/filter/ChangeLog b/filter/ChangeLog index 099de774ee..02ef3cb122 100644 --- a/filter/ChangeLog +++ b/filter/ChangeLog @@ -2,6 +2,8 @@ * filter-datespec.c (make_span_editor): Add a gettext around our static strings. + (format_time): New function. Convert a time_t to a gchar * (with i18n) + (describe_button): Use format_time instead of ctime. 2001-08-10 Peter Williams diff --git a/filter/filter-datespec.c b/filter/filter-datespec.c index fea81911a6..efc073a4d9 100644 --- a/filter/filter-datespec.c +++ b/filter/filter-datespec.c @@ -699,11 +699,24 @@ set_adjustments (FilterDatespec *fds) N_TIMESPANS - (i + 1)); } +static gchar * +format_time (time_t time) +{ + struct tm *as_tm; + char buf[128]; + + /* no idea if this format is the 'correct' one */ + + as_tm = localtime (&time); + strftime (buf, 128, _("%b %d %l:%M %p"), as_tm); + return g_strdup (buf); +} + static gchar * describe_button (FilterDatespec *fds) { gchar *desc = NULL; - + switch (fds->type) { case FDST_UNKNOWN: desc = g_strdup (_("")); @@ -712,7 +725,7 @@ describe_button (FilterDatespec *fds) desc = g_strdup (_("now")); break; case FDST_SPECIFIED: - desc = g_strdup (ctime (&(fds->value))); + desc = format_time (fds->value); break; case FDST_X_AGO: desc = stringify_agoness (fds); -- cgit v1.2.3