MCPcopy Create free account
hub / github.com/deathkiller/jazz2-native / AdjustToTimezone

Method AdjustToTimezone

Sources/Shared/Containers/DateTime.cpp:1314–1326  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1312 }
1313
1314 void DateTime::AdjustToTimezone(TimeZone tz, bool noDST) noexcept
1315 {
1316 std::int32_t secDiff = Implementation::GetTimeZone() + tz.GetOffset();
1317 std::int32_t bias = 0;
1318
1319 // We are converting from the local time to some other time zone, but local time zone does not include the DST offset
1320 // (as it varies depending on the date), so we have to handle DST manually, unless a special flag inhibiting this was specified.
1321 if (!tz.IsLocal() && !noDST && Implementation::IsDST(*this, bias)) {
1322 secDiff -= bias;
1323 }
1324
1325 _time += secDiff * 1000;
1326 }
1327
1328 void DateTime::AdjustFromTimezone(TimeZone tz, bool noDST) noexcept
1329 {

Callers 1

ToTimezoneMethod · 0.80

Calls 4

GetTimeZoneFunction · 0.85
IsDSTFunction · 0.85
IsLocalMethod · 0.80
GetOffsetMethod · 0.45

Tested by

no test coverage detected