]> git.lyx.org Git - lyx.git/blob - src/support/lyxtime.C
hopefully fix tex2lyx linking.
[lyx.git] / src / support / lyxtime.C
1 /**
2  * \file lyxtime.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author John Levon
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "support/lyxtime.h"
14 #include "lyxrc.h"
15
16 using std::string;
17
18 namespace lyx {
19
20 time_type current_time()
21 {
22         return time(0);
23 }
24
25
26 string const formatted_time(time_type t, string const & fmt)
27 {
28         struct tm * loc_tm = localtime(&t);
29         char date[50];
30         strftime(date, sizeof(date), fmt.c_str(), loc_tm);
31         return string(date);
32 }
33
34
35 string const formatted_time(time_type t)
36 {
37         return formatted_time(t, lyxrc.date_insert_format);
38 }
39
40 } // namespace lyx