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();
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;

View File

@ -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