title: C program time_t and struct tm, same result?
body: <p>I am new to C program and I got a some problem when I code the program using mktime function.</p>
  
  <p>I declare 2 time, first one is system time, and the second one is 1 day before it, here is my code:</p>
  
  <pre><code>struct tm *now = calloc(1,sizeof(struct tm));
  struct tm *dayb4 = calloc(1,sizeof(struct tm));
  time_t t1 = time(NULL);
  
  now = localtime(&amp;t1);
  dayb4 = localtime(&amp;t1);
  
  dayb4-&gt;tm_day -= 1;
  mktime(dayb4);
  </code></pre>
  
  <p>However, I found the the time "now" and "dayb4" are the same, which is 1 day before current time...
  Could anyone told me which part I getting wrong?</p>
  
  <p>Thank a lot !!!</p>