<<< Date Index >>>     <<< Thread Index >>>

[PATCH] add %D format string to $folder_format to expand the time based on $date_format



 browser.c |  22 ++++++++++++++++++----
 1 files changed, 18 insertions(+), 4 deletions(-)


# HG changeset patch
# User Michael Elkins <me@xxxxxxxx>
# Date 1271451518 25200
# Branch HEAD
# Node ID 46adbc7b88618dbe909ddb053a02b3abbfd6ae48
# Parent  15b9d6f3284f78139abefe74c2607fa2d338641b
add %D format string to $folder_format to expand the time based on $date_format.

Proposed fix for http://dev.mutt.org/trac/ticket/3406

diff --git a/browser.c b/browser.c
--- a/browser.c
+++ b/browser.c
@@ -163,10 +163,24 @@
     case 'd':
       if (folder->ff->st != NULL)
       {
-       tnow = time (NULL);
-       t_fmt = tnow - folder->ff->st->st_mtime < 31536000 ? "%b %d %H:%M" : 
"%b %d  %Y";
-       strftime (date, sizeof (date), t_fmt, localtime 
(&folder->ff->st->st_mtime));
-       mutt_format_s (dest, destlen, fmt, date);
+         int do_locales = 0;
+
+         if (op == 'D') {
+             t_fmt = NONULL(DateFmt);
+             if (*t_fmt == '!')
+                 ++t_fmt;
+             else
+                 do_locales = 1;
+         } else {
+             tnow = time (NULL);
+             t_fmt = tnow - folder->ff->st->st_mtime < 31536000 ? "%b %d 
%H:%M" : "%b %d  %Y";
+         }
+         if (do_locales && Locale)
+             setlocale(LC_TIME, Locale);
+         strftime (date, sizeof (date), t_fmt, localtime 
(&folder->ff->st->st_mtime));
+         if (do_locales)
+             setlocale(LC_TIME, "C");
+         mutt_format_s (dest, destlen, fmt, date);
       }
       else
        mutt_format_s (dest, destlen, fmt, "");