Boost logo

Boost Users :

From: Jeff Garland (jeff_at_[hidden])
Date: 2006-06-23 13:11:46


Brian Neal wrote:
>> Jeff Garland <jeff_at_[hidden]> wrote:

> So I went back and rethought about how I was using boost::date_time.
> In our pre-boost code, we were just getting these 32-bit numbers,
> essentially tick counts, from the OS. We were just using these tick
> counts for comparisons and deltas, timestamping and stuff. We
> certainly didn't need full dates, as our events last, at most, 10
> seconds. If you think about it, these tick counts are just a duration
> from some OS specific epoch. Aha, time_duration! So in our time
> critical code, we replaced all of our ptimes with time_durations, and
> replaced all calls to universal_time() with a function of our own
> making (getTimeStamp()), which calls clock_gettime() and forms up a
> time_duration with the results. This worked perfectly and brought back
> our performance to the pre-boost levels. For our other, non-critical
> time code, we just left the ptimes in.

Sounds like a good solution.

> Well, as I said, the current universal_time() is much faster than
> treating the results of clock_gettime() as a time_duration from the
> UNIX epoch. But again, after rethinking our porting to boost, we
> brought the overkill on ourselves for replacing our tick counts with
> ptimes. time_durations were a better fit for what we were doing for
> that one specific case.
>
> Thanks. Boost::date_time is a very useful and powerful library!

You're welcome.

Jeff


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