Windows: set timezone as -3600.

This commit is contained in:
Gerhard Hoffmann 2023-05-11 13:58:33 +02:00
parent 818c67ad63
commit ed9166c226

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