(entries::format_last_entry): XML format now always uses the same date

format, and ignores --date-format.
This commit is contained in:
John Wiegley 2006-02-20 04:13:02 +00:00
parent 1761ae9272
commit 34ed895907

14
xml.cc
View file

@ -336,16 +336,14 @@ void output_xml_string(std::ostream& out, const std::string& str)
void format_xml_entries::format_last_entry() void format_xml_entries::format_last_entry()
{ {
char buf[256]; char buf[32];
std::strftime(buf, 255, format_t::date_format.c_str(), std::strftime(buf, 31, "%Y/%m/%d", std::localtime(&last_entry->_date));
std::localtime(&last_entry->_date));
output_stream << " <entry>\n" output_stream << " <entry>\n"
<< " <en:date>" << buf << "</en:date>\n"; << " <en:date>" << buf << "</en:date>\n";
if (last_entry->_date_eff) { if (last_entry->_date_eff) {
std::strftime(buf, 255, format_t::date_format.c_str(), std::strftime(buf, 31, "%Y/%m/%d", std::localtime(&last_entry->_date_eff));
std::localtime(&last_entry->_date_eff));
output_stream << " <en:date_eff>" << buf << "</en:date_eff>\n"; output_stream << " <en:date_eff>" << buf << "</en:date_eff>\n";
} }
@ -375,13 +373,11 @@ void format_xml_entries::format_last_entry()
output_stream << " <transaction>\n"; output_stream << " <transaction>\n";
if ((*i)->_date) { if ((*i)->_date) {
std::strftime(buf, 255, format_t::date_format.c_str(), std::strftime(buf, 31, "%Y/%m/%d", std::localtime(&(*i)->_date));
std::localtime(&(*i)->_date));
output_stream << " <tr:date>" << buf << "</tr:date>\n"; output_stream << " <tr:date>" << buf << "</tr:date>\n";
} }
if ((*i)->_date_eff) { if ((*i)->_date_eff) {
std::strftime(buf, 255, format_t::date_format.c_str(), std::strftime(buf, 31, "%Y/%m/%d", std::localtime(&(*i)->_date_eff));
std::localtime(&(*i)->_date_eff));
output_stream << " <tr:date_eff>" << buf << "</tr:date_eff>\n"; output_stream << " <tr:date_eff>" << buf << "</tr:date_eff>\n";
} }