Boost logo

Boost Users :

From: Russell Hind (yg-boost-users_at_[hidden])
Date: 2003-07-16 04:24:37


Jim.Hyslop wrote:
>
> I don't know how the boost developers are planning on it, but the NTP
> (Network Time Protocol) uses the high performance counter functions
> (QueryHighPerformanceCounter and QueryHighPerformanceFrequency, IIRC) and
> interpolates based on that.
>

We discussed this a few months back. I don't think you can use these
because they only give a relative time, there is no way (that I know of)
to convert a performance count into an actual date/time.

It can be used for elapsed time, but not, AFAIK, for absolute time.

FWIW, I implemented a solution for Borland back then and posted it here.
  But we also discussed calling it millisec_clock since it doesn't
actually give microsec accuracy. I can't remember what the outcome was.

Cheers

Russell

      static time_type local_time()
      {
      #ifdef __BORLANDC__
      SYSTEMTIME lt;
          GetLocalTime(&lt);

      date_type d = date_type(lt.wYear,
                              lt.wMonth,
                              lt.wDay);

      int adjust = resolution_traits_type::res_adjust() / 1000;
      time_duration_type td = time_duration_type(lt.wHour,
                                                 lt.wMinute,
                                                 lt.wSecond,
                                                 lt.wMilliseconds * adjust);
          return time_type(d, td);
      #else
      ....
      #endif
      }


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net