On Tuesday, August 21, 2012 11:01:37 AM UTC+4, Marcin Szamotulski wrote:
> Dear Vim_Dev,
> 
> 
> 
> I found that when I use g-, g+ to move to through undo tree the day of
> 
> the month always follows the month independently of the locale:
> 
> 
> 
> LC_TIME='en_GB.utf8' vim <some file with undo tree longer than just today>
> 
> then g- shows (after hitting changes from yesterday):
> 
> 
> 
> 1 change; before #1829  08/20 17:58:52
> 
> 
> 
> while I think it should be
> 
> 
> 
> 1 change; before #1829  20/08 17:58:52
> 
> 
> 
> This is quite confusing for me.
> 
> 
> 
> Best regards,
> 
> Marcin Szamotulski

Hello, Marcin and vim_dev.

I think I got a patch which resolves this issue, but I don't have so old undo 
history near at hand, so I've tested it only independently of a vim.
Please look at local_date_fmt.diff in attachments.

-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
diff -r 536aa8b0c934 src/undo.c
--- a/src/undo.c	Wed Aug 15 17:43:31 2012 +0200
+++ b/src/undo.c	Tue Aug 21 16:28:05 2012 +0400
@@ -2871,26 +2871,29 @@
     size_t	buflen;
     time_t	tt;
 {
+    time_t now = time(NULL);
 #ifdef HAVE_STRFTIME
-    struct tm	*curtime;
-
-    if (time(NULL) - tt >= 100)
+    if (now - tt >= 100)
     {
-	curtime = localtime(&tt);
-	if (time(NULL) - tt < (60L * 60L * 12L))
+	struct tm *curtime = localtime(&tt);
+	if (now - tt < (60L * 60L * 12L))
 	    /* within 12 hours */
 	    (void)strftime((char *)buf, buflen, "%H:%M:%S", curtime);
-	else if (time(NULL) - tt < (60L * 60L * 24L * 180L))
+	else if (now - tt < (60L * 60L * 24L * 180L))
+        {
 	    /* within 6 months */
-	    (void)strftime((char *)buf, buflen, "%m/%d %H:%M:%S", curtime);
+	    (void)strftime((char *)buf, buflen, "%x", curtime);
+            /* save only dd/mm or mm/dd part */
+            (void)strftime((char *)buf + 5, buflen - 5, " %H:%M:%S", curtime);
+        }
 	else
 	    /* long ago */
-	    (void)strftime((char *)buf, buflen, "%Y/%m/%d %H:%M:%S", curtime);
+	    (void)strftime((char *)buf, buflen, "%x %H:%M:%S", curtime);
     }
     else
 #endif
 	vim_snprintf((char *)buf, buflen, _("%ld seconds ago"),
-						     (long)(time(NULL) - tt));
+						     (long)(now - tt));
 }
 
 /*

Raspunde prin e-mail lui