|
Boost : |
From: Jeff Garland (jeff_at_[hidden])
Date: 2004-11-22 15:39:27
On Mon, 22 Nov 2004 19:09:38 +0100, Pavol Droba wrote
> Oh, sorry, I did mean time_duration. I will give an example.
> Imagine, that you have time_duration that spans over multiple years.
> Internal ticks_ value is quite large number.
>
> Now lets's say it is 1000000 ... I'd like to multily it by 0.55. It
> will be nice integer after the operation. But there is no other
> reasonable way to do if otherwise.
>
> Just in case you wondering what can be use case for such an
> operation, imagine a graph where x-axis represents a timeline
> between two timestamps. If you want to draw a grid, you will need to
> multiply the time difference by 0.1 0.2 0.3 and etc.
Actually, I think there is an easier way. I'd calculate the difference
between the 2 timestamps (divided by the number of divisions) to get the
the 'step' of the grid. Then I'd create time_iterator with the calculated
step to generate the values of the grid. If you haven't used the
time_iterator you might have a look at:
http://www.boost.org/doc/html/date_time/posix_time.html#date_time.posix_time.
time_iterators
Jeff
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk