]> gitweb.hhaalo.de Git - feierabend.git/commitdiff
add begin time
authorBastian Dehn <hhaalo@arcor.de>
Sat, 22 Jun 2024 07:24:06 +0000 (09:24 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Sat, 22 Jun 2024 07:24:06 +0000 (09:24 +0200)
src/feierabendxml.c

index a2972a23a102bcc4bbc4923c6a1365fa3c1c9034..e449ca8940c419fcc74e19dc5602f5ed33ae11c2 100644 (file)
@@ -95,6 +95,22 @@ int main(int argc, char* argv[])
        free(xmlElemContent);
        xmlElemContent = NULL;
 
+       time(fabend->begin);
+       fabend->begin_tm = gmtime(fabend->begin);
+       fabend->begin_tm->tm_hour = atoi(argv[1]);
+       fabend->begin_tm->tm_min = atoi(argv[2]);
+       sprintf(value, "%02d:%02d",
+               fabend->begin_tm->tm_hour,
+               fabend->begin_tm->tm_min);
+       xmlElemName = xmlCharStrdup("begin");
+       xmlElemContent = xmlCharStrdup(value);
+       xmlTextWriterWriteAttribute(xmlWriter, xmlElemName, xmlElemContent);
+       memset(value, 0, MAX_STRING_LENGTH);
+       free(xmlElemName);
+       xmlElemName = NULL;
+       free(xmlElemContent);
+       xmlElemContent = NULL;
+
        xmlTextWriterEndElement(xmlWriter);
        xmlTextWriterEndElement(xmlWriter);
        xmlTextWriterEndDocument(xmlWriter);