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