Merge branch 'master' of git.mimbach49.de:GerhardHoffmann/MOBILISIS-Calculator

This commit is contained in:
Siegfried Siegert 2023-05-12 12:43:49 +02:00
commit ee1f7eca44
Signed by: SiegfriedSiegert
GPG Key ID: 68371E015E8F0B03
2 changed files with 18 additions and 8 deletions

View File

@ -28,6 +28,8 @@ CalcState CALCULATE_LIBRARY_API init_tariff(parking_tariff_t **tariff, char cons
*tariff = new Configuration(); *tariff = new Configuration();
CalcState calcState; CalcState calcState;
#if __linux__
int const zone = get_zone_nr(); int const zone = get_zone_nr();
// DEBUG // DEBUG
@ -49,6 +51,9 @@ CalcState CALCULATE_LIBRARY_API init_tariff(parking_tariff_t **tariff, char cons
memset(buffer, 0x00, sizeof(buffer)); memset(buffer, 0x00, sizeof(buffer));
snprintf(buffer, sizeof(buffer)-1, "tariff%02d.json", zone); snprintf(buffer, sizeof(buffer)-1, "tariff%02d.json", zone);
confFile += buffer; confFile += buffer;
#else // windows
QString confFile(config_file);
#endif
// DEBUG // DEBUG
qCritical() << " ... confFile = " << confFile; qCritical() << " ... confFile = " << confFile;

View File

@ -271,14 +271,19 @@ std::string Calculator::GetDurationFromCost(Configuration* cfg,
cout << "Total minutes: " << (int)ret_val << endl; cout << "Total minutes: " << (int)ret_val << endl;
if (ret_val <= 0) return "PARKING NOT ALLOWED"; if (ret_val <= 0) return "PARKING NOT ALLOWED";
#if !defined(_SVID_SOURCE) && !defined(_XOPEN_SOURCE) #ifdef __linux__
// needed for timezone-correction #if !defined(_SVID_SOURCE) && !defined(_XOPEN_SOURCE)
#error "!defined(_SVID_SOURCE) && !defined(_XOPEN_SOURCE)" // needed for timezone-correction
#else #error "!defined(_SVID_SOURCE) && !defined(_XOPEN_SOURCE)"
// timezone correction: localtime() needs argument in UTC-timezone #else
// The global variable 'timezone' is set by tzset(), see // timezone correction: localtime() needs argument in UTC-timezone
// https://linux.die.net/man/3/tzset, so I change of the timezone will // The global variable 'timezone' is set by tzset(), see
// also change the value of the variable 'timezone'. // 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; valid_until_datetime_t += timezone;
#endif #endif