int begin_min,
int end_hour,
int end_min,
- int last_saldo)
+ time_t last_saldo)
{
feierabend* fabend = malloc(sizeof(feierabend));
init_feierabend(fabend);
int end_min,
const char* file_path)
{
- char* saldo = malloc(sizeof(char) * MAX_STRING_LENGTH);
- memset(saldo, 0, MAX_STRING_LENGTH);
-
- readLastSaldo(file_path, saldo);
+ char* saldostr = malloc(sizeof(char) * MAX_STRING_LENGTH);
+ memset(saldostr, 0, MAX_STRING_LENGTH);
+ readLastSaldo(file_path, saldostr);
xmlChar* xmlElemContent = NULL;
xmlTextWriterPtr xmlwriter = xmlNewTextWriterFilename("/dev/stdout", 0);
}
}
+ time_t* saldo = malloc(sizeof(time_t));
+ get_seconds_from_string(saldostr, saldo);
+ writeEntryNode(xmlwriter, begin_hour, begin_min, end_hour, end_min, *saldo);
xmlTextWriterEndElement(xmlwriter);
xmlTextWriterEndDocument(xmlwriter);
xmlCleanupCharEncodingHandlers();
xmlDictCleanup();
+ free(xmlElemContent);
+ xmlElemContent = NULL;
free(saldo);
saldo = NULL;
+ free(saldostr);
+ saldostr = NULL;
}
int main(int argc, char* argv[])
void get_seconds_from_string(const char* timestr, time_t* seconds)
{
+ char* first_str_pos = NULL;
char* str = malloc(sizeof(char) * 7);
memset(str, 0, 7);
strncpy(str, timestr, 7);
+ first_str_pos = str;
str = strtok(str, ":");
*seconds = atol(str) * ONE_HOUR;
str = strtok(NULL, ":");
*seconds += atol(str) * 60;
+
+ free(first_str_pos);
+ first_str_pos = NULL;
}
void get_weekday(int wday, char* weekday)