title: Initializing static struct tm in a class
body: <p>I would like to use the tm struct as a static variable in a class. Spent a whole day reading and trying but it still can't work :( Would appreciate if someone could point out what I was doing wrong</p>
  
  <p>In my class, under Public, i have declared it as:</p>
  
  <pre><code>static struct tm *dataTime;
  </code></pre>
  
  <p>In the main.cpp, I have tried to define and initialize it with system time temporarily to test out (actual time to be entered at runtime)</p>
  
  <pre><code>time_t rawTime;
  time ( &amp;rawTime );
  tm Indice::dataTime = localtime(&amp;rawTime);
  </code></pre>
  
  <p>but seems like i can't use time() outside functions.</p>
  
  <blockquote>
    <p>main.cpp:28: error: expected
    constructor, destructor, or type
    conversion before ‘(’ token</p>
  </blockquote>
  
  <p>How do I initialize values in a static tm of a class?</p>