Opened 12 years ago

#5195 new Bugs

time_duration visualizer works incorrectly with negative duration

Reported by: Igor R. <boost.lists@…> Owned by: fkonvick
Milestone: To Be Determined Component: date_time
Version: Boost 1.46.0 Severity: Cosmetic
Keywords: Cc:

Description

86400000000 unsigned 64 bit integer is mixed with signed integers. The fix is to use 86400000000I64 instead, as follows:

;------------------------------------------------------------------------------ ; boost::posix_time::time_duration visualizer ; only works with microseconds resolution ;------------------------------------------------------------------------------

boost::posix_time::time_duration{

preview (

#(

$c.ticks_.value_/86400000000I64, "d ", ($c.ticks_.value_-86400000000I64*($c.ticks_.value_/86400000000I64))/3600000000, "h ", ($c.ticks_.value_-86400000000I64*($c.ticks_.value_/86400000000I64)-3600000000*(($c.ticks_.value_-86400000000I64*($c.ticks_.value_/86400000000I64))/3600000000))/60000000, "m ", (($c.ticks_.value_-86400000000I64*($c.ticks_.value_/86400000000I64)-3600000000*(($c.ticks_.value_-86400000000I64*($c.ticks_.value_/86400000000I64))/3600000000))-60000000*(($c.ticks_.value_-86400000000I64*($c.ticks_.value_/86400000000I64) - 3600000000*(($c.ticks_.value_-86400000000I64*($c.ticks_.value_/86400000000I64))/3600000000))/60000000))/1000000, "s ", ($c.ticks_.value_%1000000)/1000, "ms ", $c.ticks_.value_%1000, "us"

)

)

}

Change History (0)

Note: See TracTickets for help on using tickets.