title: Compare time in C
body: <p>I'm trying to make a program that prints out messages after a certain date. Kinda like an archive. For example, today it should only print out "hello". The next day, it should print out "world". But it should still print out "hello" since I've passed the date that "hello" should be printed out already.</p>
  
  <p>I'm sure you can do this with some basic if conditions and just comparing the values inside a localtimed <code>struct tm</code>, but I think there's a faster and more efficient way of doing this. The <code>if</code> condition method takes a ridiculously long code as well. I tried browsing stackoverflow and I found the <code>difftime</code> method. The problem is, the <code>difftime</code> parameters are </p>
  
  <pre><code>double difftime(time_t time1, time_t time0)
  </code></pre>
  
  <p>and I don't know how to initialize the localtime into one of them and a specific date into the other.</p>
  
  <p>So to cut it short, my questions are:</p>
  
  <ol>
  <li><p>How do I set a specific date into a time_t variable?</p></li>
  <li><p>How do I set time_t variable into <code>localtime</code> (if you're going to use the <code>struct tm localtime = *localtime(&amp;time_t)</code> method, would you please tell me how to convert the struct variable back into a <code>time_t</code> variable so I can insert it into the parameters of <code>difftime</code>)?</p></li>
  </ol>