title: Calendar function crashes when invoking 'localtime_s'
body: <p>I'm trying to make a callendar, so I use time_t and localtime_s to store the time and date info and then store it in individual members of the Calendar class:</p>
  
  <pre><code>void Callendar::Initialize()
  {
      time_t now = time(0);
      tm *localTime = null;
      localtime_s(localTime, &amp;now);
  
      LocalSeconds = localTime-&gt;tm_sec;
      LocalMinutes = localTime-&gt;tm_min;
      LocalHours = localTime-&gt;tm_hour;
      LocalDays = localTime-&gt;tm_mday;
      LocalMonths = localTime-&gt;tm_mon;
      LocalYears = localTime-&gt;tm_year;
      DaysSinceSunday = localTime-&gt;tm_wday;
      DaysSinceJanuaryFirst = localTime-&gt;tm_yday;
      HoursDaylightSavings = localTime-&gt;tm_isdst;
  }
  </code></pre>
  
  <p>All compiles fine, however at runtime I get:</p>
  
  <blockquote>
    <p>Debug Assertion Failed!</p>
    
    <p>Program: C:\Users\MyPC\Desktop\Framework\Framework\Debug\Framework.exe
    File: f:\dd\vctools\crt_bld\self_x86\crt\src\loctim64.c Line: 69</p>
    
    <p>Expression: ( ptm != NULL )</p>
  </blockquote>
  
  <p>After I close the failed assert message, I get a standart debug error at this line:</p>
  
  <pre><code>static __inline errno_t __CRTDECL localtime_s(struct tm * _Tm, const time_t * _Time)
  {
      return _localtime64_s(_Tm, _Time);
  }
  </code></pre>
  
  <p>Which is basically the result of calling *localtime_s(localTime, &amp;now);* in <em>Calendar:Initialize()</em>
  Could I possibly using a deprecated version of this functionality?I know there are other functions to get localtime, but I don't know which is the "proper" one.Others have suggested to me that I shouldn't use 'localtime', but seemingly localtime_s isn't working out either.</p>