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

index 15fd62e696b6ae7c9af548fd5c4a243ae3462ba4..c71c1c93f3b3ae36e74c3130c3ae333195c1e658 100644 (file)
@@ -74,6 +74,9 @@ int main(int argc, char* argv[])
 
        time(fabend->now);
        fabend->now_tm = gmtime(fabend->now);
+       fabend->now_tm->tm_hour = atoi(argv[3]);
+       fabend->now_tm->tm_min = atoi(argv[4]);
+       *fabend->now = mktime(fabend->now_tm);
        get_short_weekday(fabend->now_tm->tm_wday, value);
        xmlElemName = xmlCharStrdup("wochentag");
        xmlElemContent = xmlCharStrdup(value);
@@ -104,6 +107,7 @@ int main(int argc, char* argv[])
        sprintf(value, "%02d:%02d",
                fabend->begin_tm->tm_hour,
                fabend->begin_tm->tm_min);
+       *fabend->begin = mktime(fabend->begin_tm);
        xmlElemName = xmlCharStrdup("begin");
        xmlElemContent = xmlCharStrdup(value);
        xmlTextWriterWriteAttribute(xmlWriter, xmlElemName, xmlElemContent);
@@ -150,6 +154,17 @@ int main(int argc, char* argv[])
        free(xmlElemContent);
        xmlElemContent = NULL;
 
+       *fabend->worktime = get_current_worktime(*fabend->begin, *fabend->now);
+       get_time_str(*fabend->worktime, value);
+       xmlElemName = xmlCharStrdup("arbeitszeit");
+       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);