From 818c67ad63d5fb2fa8513b31aa57675cac5dbfd7 Mon Sep 17 00:00:00 2001 From: Gerhard Hoffmann Date: Thu, 11 May 2023 13:57:31 +0200 Subject: [PATCH 1/2] Windows debug: for init-Tariff, do not read zone_ne, but use the path given directly. --- library/src/calculate_price.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/library/src/calculate_price.cpp b/library/src/calculate_price.cpp index 090ac11..d4bde75 100644 --- a/library/src/calculate_price.cpp +++ b/library/src/calculate_price.cpp @@ -28,6 +28,8 @@ CalcState CALCULATE_LIBRARY_API init_tariff(parking_tariff_t **tariff, char cons *tariff = new Configuration(); CalcState calcState; +#if __linux__ + int const zone = get_zone_nr(); // DEBUG @@ -49,6 +51,9 @@ CalcState CALCULATE_LIBRARY_API init_tariff(parking_tariff_t **tariff, char cons memset(buffer, 0x00, sizeof(buffer)); snprintf(buffer, sizeof(buffer)-1, "tariff%02d.json", zone); confFile += buffer; +#else // windows + QString confFile(config_file); +#endif // DEBUG qCritical() << " ... confFile = " << confFile; From ed9166c226eb652c52e2aa1c6738c9a2ea4acb32 Mon Sep 17 00:00:00 2001 From: Gerhard Hoffmann Date: Thu, 11 May 2023 13:58:33 +0200 Subject: [PATCH 2/2] Windows: set timezone as -3600. --- library/src/calculator_functions.cpp | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/library/src/calculator_functions.cpp b/library/src/calculator_functions.cpp index c8eea44..6c45218 100644 --- a/library/src/calculator_functions.cpp +++ b/library/src/calculator_functions.cpp @@ -271,14 +271,19 @@ std::string Calculator::GetDurationFromCost(Configuration* cfg, cout << "Total minutes: " << (int)ret_val << endl; if (ret_val <= 0) return "PARKING NOT ALLOWED"; -#if !defined(_SVID_SOURCE) && !defined(_XOPEN_SOURCE) - // needed for timezone-correction - #error "!defined(_SVID_SOURCE) && !defined(_XOPEN_SOURCE)" -#else - // timezone correction: localtime() needs argument in UTC-timezone - // The global variable 'timezone' is set by tzset(), see - // https://linux.die.net/man/3/tzset, so I change of the timezone will - // also change the value of the variable 'timezone'. +#ifdef __linux__ + #if !defined(_SVID_SOURCE) && !defined(_XOPEN_SOURCE) + // needed for timezone-correction + #error "!defined(_SVID_SOURCE) && !defined(_XOPEN_SOURCE)" + #else + // timezone correction: localtime() needs argument in UTC-timezone + // The global variable 'timezone' is set by tzset(), see + // https://linux.die.net/man/3/tzset, so I change of the timezone will + // also change the value of the variable 'timezone'. + valid_until_datetime_t += timezone; + #endif +#else // windows, only for testing + static const long timezone = -3600; valid_until_datetime_t += timezone; #endif