]> git.lyx.org Git - lyx.git/blob - src/support/lyxtime.cpp
Now that exceptions are allowed, handle gracefully the case where a Buffer temp direc...
[lyx.git] / src / support / lyxtime.cpp
1 /**
2  * \file lyxtime.cpp
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
15 using namespace std;
16
17 namespace lyx {
18
19 time_t current_time()
20 {
21         return time(0);
22 }
23
24
25 string const formatted_time(time_t t, string const & fmt)
26 {
27         struct tm * loc_tm = localtime(&t);
28         char date[50];
29         strftime(date, sizeof(date), fmt.c_str(), loc_tm);
30         return string(date);
31 }
32
33 } // namespace lyx