title: Converting time_t to int
body: <p>I want to convert a given time into epoch(time_t) and vice versa. can anyone tell what is the routine or algorithm for this?</p>
  
  <p>Thanks</p>
  
  <p><strong>Update</strong></p>
  
  <pre><code> epoch_strt.tm_sec = 0;
   epoch_strt.tm_min = 0;
   epoch_strt.tm_hour = 0;
  epoch_strt.tm_mday = 1;
  epoch_strt.tm_mon = 1;
  epoch_strt.tm_year = 70;
   epoch_strt.tm_isdst = -1;
  
  double nsecs = difftime(curtime, basetime);//current time from system, I converrting it to struct tm
  </code></pre>
  
  <p>but this always return 32399 for some reason.</p>