Board index » cppbuilder » TDateTime Fractional Times
Heinz Ketchup
![]() CBuilder Developer |
TDateTime Fractional Times2006-08-04 01:20:28 AM cppbuilder111 Hello, I've designed an algorithm / calculations around TDateTime's. But I'm having some problems with the date Mathematics... Scenario... A Car is driving from Point A to Point C, but stops along the way (Point B) The amount of time in minutes to get from: Point A to Point B = 9.69696969696969696969 Minutes Point B to Point C = 10.3030303030303030301 Minutes Total Time From Point A to Point C = 20 Minutes If the Car starts driving from Point A @ 8:00 am, and it takes 20 minutes to get to Point C (8:20 am) then... What is the exact time at Point B? What I do, that I thought worked... was psuedo code: PointBDateTime = IncMinute(StartingDateTime, 9) double = 9.69696969696969 Minutes - 9 minutes = .696969696969696969 // Change Decimal Portion to Seconds .696969696969696969 * 60 = 41.8181818181818181 seconds PointBDateTime = IncSeconds(PointBDateTime, 41) // Change Decimal Portion to MilliSeconds double = .81818181818181818 * 60 = 49.090909090909 PointBDateTime = IncMilliSeconds(PointBDateTime, 49) Is this mucked up? TIA, Heinz |