Added sone test code for Schoenau, Koenigsee.
This commit is contained in:
parent
10b018a338
commit
86c27986cc
@ -24,10 +24,16 @@ extern "C" char* strptime(const char* s,
|
||||
#endif
|
||||
|
||||
#include "calculate_price.h"
|
||||
#include "calculator_functions.h"
|
||||
#include "payment_method.h"
|
||||
|
||||
|
||||
#include <QDebug>
|
||||
#include <QDateTime>
|
||||
|
||||
|
||||
static Calculator calculator;
|
||||
|
||||
int main() {
|
||||
|
||||
parking_tariff_t *tariff = 0;
|
||||
@ -37,24 +43,27 @@ int main() {
|
||||
memset(&price, 0x00, sizeof(price));
|
||||
// QDateTime start = QDateTime::fromString("2023-06-01T07:50:00.000Z",Qt::ISODate); //QDateTime::currentDateTime();
|
||||
QDateTime start = QDateTime::currentDateTime();
|
||||
time_t start_parking_time = start.toSecsSinceEpoch() / 60;
|
||||
// time_t start_parking_time = start.toSecsSinceEpoch() / 60;
|
||||
|
||||
// zone 1
|
||||
int timeSteps[9] = {60, 180, 1440, 2880, 4320, 5670, 7200, 8640, 10080};
|
||||
//int timeSteps[9] = {60, 180, 1440, 2880, 4320, 5670, 7200, 8640, 10080};
|
||||
|
||||
// zone 2
|
||||
//int timeSteps[3] = {60, 180, 1440};
|
||||
|
||||
for (int i = 0 ; i < sizeof(timeSteps)/sizeof(int); ++i) {
|
||||
time_t end_parking_time = start_parking_time + timeSteps[i];
|
||||
static QList<int> const timeSteps = calculator.GetTimeSteps(tariff, PaymentMethod::Steps);
|
||||
|
||||
if (compute_price_for_parking_ticket(tariff,
|
||||
start_parking_time,
|
||||
end_parking_time,
|
||||
&price))
|
||||
{
|
||||
qDebug() << "GetCostFromDuration() time: " << timeSteps[i] << "price=" << price.netto;
|
||||
}
|
||||
qCritical() << timeSteps;
|
||||
|
||||
for (int i = 0 ; i < timeSteps.size(); ++i) {
|
||||
// time_t end_parking_time = start_parking_time + timeSteps[i];
|
||||
QDateTime end = start.addSecs(timeSteps.at(i)*60);
|
||||
|
||||
double price = calculator.GetCostFromDuration(tariff,
|
||||
start,
|
||||
timeSteps.at(i),
|
||||
PaymentMethod::Steps);
|
||||
qDebug() << "GetCostFromDuration() time: " << timeSteps.at(i) << "price=" << price;
|
||||
}
|
||||
|
||||
free_tariff(tariff);
|
||||
|
Loading…
Reference in New Issue
Block a user