init_feierabend(fabend);
xmlChar* xmlElemName = xmlCharStrdup("zeitkonto");
xmlChar* xmlElemContent = NULL;
- char* wdayshort = malloc(sizeof(char) * 3);
+ char* value = malloc(sizeof(char) * 11);
xmlTextWriterPtr xmlWriter = xmlNewTextWriterFilename("/dev/stdout", 0);
xmlTextWriterSetIndent(xmlWriter, 8);
xmlElemName = NULL;
time(fabend->now);
fabend->now_tm = gmtime(fabend->now);
- get_short_weekday(fabend->now_tm->tm_wday, wdayshort);
- xmlElemContent = xmlCharStrdup(wdayshort);
- free(wdayshort);
- wdayshort = NULL;
+ get_short_weekday(fabend->now_tm->tm_wday, value);
+ xmlElemContent = xmlCharStrdup(value);
xmlElemName = xmlCharStrdup("wochentag");
xmlTextWriterWriteAttribute(xmlWriter, xmlElemName, xmlElemContent);
free(xmlElemName);
xmlElemName = NULL;
free(xmlElemContent);
xmlElemContent = NULL;
+ xmlElemName = xmlCharStrdup("datum");
+ sprintf(value, "%04d-%02d-%02d",
+ fabend->now_tm->tm_year + 1900,
+ fabend->now_tm->tm_mon + 1,
+ fabend->now_tm->tm_mday);
+ xmlElemContent = xmlCharStrdup(value);
+ xmlTextWriterWriteAttribute(xmlWriter, xmlElemName, xmlElemContent);
+ free(xmlElemName);
+ xmlElemName = NULL;
+ free(xmlElemContent);
+ xmlElemContent = NULL;
xmlTextWriterEndElement(xmlWriter);
xmlTextWriterEndElement(xmlWriter);
xmlTextWriterEndDocument(xmlWriter);
+ free(value);
+ value = NULL;
free(xmlElemContent);
xmlElemContent = NULL;
free(xmlElemName);