]> git.lyx.org Git - lyx.git/blobdiff - src/support/lyxtime.C
* support/os_unix.C (canAutoOpen, autoOpenFile): on Mac OS X, use
[lyx.git] / src / support / lyxtime.C
index 6bcc4ff87ff81a14d750b0d772e2872392fd7531..aabd1229dab1a7cbfb82b93d23d71342619f8f16 100644 (file)
 
 #include <config.h>
 
-#include "lyxtime.h"
+#include "support/lyxtime.h"
+#include "lyxrc.h"
+
+using std::string;
 
 namespace lyx {
 
@@ -19,4 +22,19 @@ time_type current_time()
        return time(0);
 }
 
+
+string const formatted_time(time_type t, string const & fmt)
+{
+       struct tm * loc_tm = localtime(&t);
+       char date[50];
+       strftime(date, sizeof(date), fmt.c_str(), loc_tm);
+       return string(date);
+}
+
+
+string const formatted_time(time_type t)
+{
+       return formatted_time(t, lyxrc.date_insert_format);
+}
+
 } // namespace lyx