Boost logo

Boost Users :

From: Jeff Garland (jeff_at_[hidden])
Date: 2003-03-20 13:13:26


> willw_at_ais wrote

> // Get next time (>= start) which falls on an itvl boundary
> ptime GetNextBoundary2(const ptime& start, const time_duration& itvl)
> {
> // Use 1/1/1970 as a base - not ideal but good enough for this
> const ptime origin(date(1970,1,1));
> time_duration start_offset = start - origin;
> return ptime (start + itvl -
> nanosec(start_offset.ticks() % itvl.ticks()));
> }

Not sure this will compile. I think you might need to try:
      // |
      //Note comma v
         return ptime (start, itvl - nanosec(start_offset.ticks() % itvl.ticks()));

> This fails because - among other reasons - although I can get ticks
> out, nanosec() won't put them back in again. I guess it is normalising
> on the way in?

Not really, just adjustment of a count to the appropriate resolution.
Maybe you could be a little bit more specific about how this is
'failing' -- runtime or compile time...

HTH,

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