2003-02-08 19:18:01 +00:00
|
|
|
/**
|
|
|
|
* \file lyxtime.C
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* \author John Levon
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
* Full author contact details are available in file CREDITS.
|
2003-02-08 19:18:01 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
2004-11-07 13:22:51 +00:00
|
|
|
#include "support/lyxtime.h"
|
2005-07-05 09:01:52 +00:00
|
|
|
#include "lyxrc.h"
|
|
|
|
|
|
|
|
using std::string;
|
2003-02-08 19:18:01 +00:00
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
|
|
|
|
time_type current_time()
|
|
|
|
{
|
|
|
|
return time(0);
|
|
|
|
}
|
|
|
|
|
2005-07-05 09:01:52 +00:00
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2003-02-08 19:18:01 +00:00
|
|
|
} // namespace lyx
|