title: convert time_t to ticks
body: <p>I have a function that convert ticks to time_t format</p>
  
  <pre><code> long ticks = DateTime.Now.Ticks;
  
         long tt = GetTimeTSecondsFrom(ticks);
  
    long GetTimeTSecondsFrom(long ticks)
      {
          DateTime epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
          return (long) (new DateTime(ticks) - epoch).TotalSeconds;
      }
  </code></pre>
  
  <p>Now i am confused how to convert it back to ticks with some mathematical formula and not with a function.</p>
  
  <p>Any suggestions...??</p>
  
  <p>thanks</p>
  
  <p>Let me take a general case and explain.
  DateTime.Now.Ticks give me a value 633921719670980000 which is in tics</p>
  
  <p>then i convert this in time_t with the above function and get tt = 1256575167</p>
  
  <p>now i want to convert this back to 633921719670980000. for this i need a formula</p>