JChristensen/Timezone

Issues from blog

JChristensen opened this issue · 0 comments

Found a couple of issues with the Timezone library:

  1. In calcTimeChanges()
  • The following doesn't look right.
    m_dstUTC = m_dstLoc - m_std.offset * SECS_PER_MIN;
    m_stdUTC = m_stdLoc - m_dst.offset * SECS_PER_MIN;
  • Should it be:
    m_dstUTC = m_dstLoc - m_dst.offset * SECS_PER_MIN;
    m_stdUTC = m_stdLoc - m_std.offset * SECS_PER_MIN;
  1. Initialization of the following member variables missing in the constructor.
   m_dstUTC = 0; 
   m_stdUTC = 0;
   m_dstLoc = 0;
   m_stdLoc = 0;
  • The new operator may not necessarily zeros the member variables (implementation dependent). This causes the utcIsDST() method to return false, resulting in the daylight saving not working properly.