Angus Leeming wrote:
> It looks like strftime will "just work" on Windows too.
> http://msdn.microsoft.com/library/en-us/vclib/html/_crt_strftime.2c_.wcsfti
>me.asp

Cool (you could verify with m-x date-insert).
The attached implementation works here, using the date settings from the 
preferences. 

BTW I don't think that the default format used there is correct. The date 
separator is missing (German: "4 Juli 2005" instead of "4. Juli 2005").

Jürgen
Index: controllers/ControlChanges.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/ControlChanges.C,v
retrieving revision 1.18
diff -u -r1.18 ControlChanges.C
--- controllers/ControlChanges.C	11 Oct 2004 14:29:14 -0000	1.18
+++ controllers/ControlChanges.C	4 Jul 2005 15:16:56 -0000
@@ -19,14 +19,13 @@
 #include "changes.h"
 #include "funcrequest.h"
 #include "lyxfind.h"
-#include "support/lstrings.h"
+#include "lyxrc.h"
 
 using std::string;
 
 namespace lyx {
 
-using support::rtrim;
-
 namespace frontend {
 
 
@@ -47,9 +46,11 @@
 	if (c.type == Change::UNCHANGED || !c.changetime)
 		return string();
 
-	// ctime adds newline; trim it off!
-	string const date = rtrim(ctime(&c.changetime), "\n");
-	return date;
+	struct tm * chng_tm = localtime(&c.changetime);
+	char date[50];
+	strftime(date, sizeof(date),
+		lyxrc.date_insert_format.c_str(), chng_tm);
+	return string(date);
 }
 
 

Reply via email to