MCPcopy Create free account
hub / github.com/MonaSolutions/MonaServer / localOffsetUsingRules

Method localOffsetUsingRules

MonaBase/sources/Timezone.cpp:612–627  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

610}
611
612Int32 Timezone::localOffsetUsingRules(const Date& date,UInt32 clock,bool& isDST) {
613 if (!_StartDST)
614 return _offset; // no daylight
615
616 // no transitions, use default rule
617 if (date.month() < _StartDST.month || (_EndDST && date.month() > _EndDST.month))
618 return _offset; // no daylight
619
620 if (date.month() == _StartDST.month)
621 isDST = !isBeforeTransition(date,clock, _StartDST);
622 else if (_EndDST && date.month() == _EndDST.month)
623 isDST = isBeforeTransition(date, clock, _EndDST);
624 else
625 isDST = true;
626 return isDST ? _dstOffset : _offset;
627}
628
629bool Timezone::isBeforeTransition(const Date& date,UInt32 clock,const TransitionRule& rule) {
630 // Consider that we are on the same month, and rule!=NIL! (caller checking)

Callers 1

LocalOffsetUsingRulesMethod · 0.80

Calls 1

monthMethod · 0.80

Tested by

no test coverage detected