title: How to compute number of seconds since the beginning of this day?
body: <p>I want to get the number of seconds since midnight. </p>
  
  <p>Here is my first guess:</p>
  
  <pre><code>  time_t current;
    time(&amp;current);
    struct tm dateDetails;
    ACE_OS::localtime_r(&amp;current, &amp;dateDetails);
  
    // Get the current session start time
    const time_t yearToTime     = dateDetails.tm_year - 70; // year to 1900 converted into year to 1970
    const time_t ydayToTime     = dateDetails.tm_yday;
    const time_t midnightTime   = (yearToTime * 365 * 24 * 60 * 60) + (ydayToTime* 24 * 60 * 60);
    StartTime_                  = static_cast&lt;long&gt;(current - midnightTime);
  </code></pre>