start changes for neuhauser

This commit is contained in:
2023-11-24 13:23:59 +01:00
parent 8f2609c4ae
commit 36478e111e
4 changed files with 168 additions and 172 deletions

View File

@@ -36,7 +36,7 @@ extern "C" char* strptime(const char* s,
int main() {
std::ifstream input(QDir::homePath().append("/tariff01.json").toStdString());
std::ifstream input("/tmp/tariff_korneuburg.json");
std::stringstream sstr;
while(input >> sstr.rdbuf());
std::string json(sstr.str());
@@ -47,14 +47,12 @@ int main() {
bool isParsed = cfg.ParseJson(&cfg, json.c_str());
cout << endl;
char const *startDate = "";
if (isParsed)
{
startDate = "2023-05-10T13:52:18.665Z";
std::string duration = calculator.GetDurationFromCost(&cfg, 3, (char *)startDate, 33, false, true);
cout << "---> startDate " << startDate << " _price_ = " << 33
<< " Total duration is: " << duration << endl;
QDateTime start = QDateTime::fromString("2023-05-11T08:00:00",Qt::ISODate);
QDateTime end = start.addSecs(120);
calculator.GetCostFromDuration(&cfg, 3, start, end, 60);
}
return 0;
@@ -69,6 +67,7 @@ int main() {
if (init_tariff(&tariff, "/etc/psa_tariff/")) {
struct price_t price;
memset(&price, 0x00, sizeof(price));
QDateTime start = QDateTime::fromString("2023-05-11T07:50:00",Qt::ISODate); //QDateTime::currentDateTime();
time_t start_parking_time = start.toSecsSinceEpoch() / 60;
time_t end_parking_time = start_parking_time + 615;