FSXA How to convert in .NET

#1
Hi all,

Having an issue when I try to convert a integer value to double / decimal value with VB.NET.
Let me explain with an example. From a Traffic.bgl file I read the departure time and arrival time.
From Flightplan editor i have following leg information
Departs 1/12:00
Arrives 12:27

When I now read the same bgl file and put the original UInteger value to my function
I receive following result

Departs 0/12.00
Arrives 0/12:27

So one should say that the rounding of my decimal / double values are wrong.
Can someone explain me on what basis the rounding function for the traffic.bgl file is based, cause as far as I can see the normal banking rounding isn't working on any traffic.bgl file. It's even so strange that due to this rounding issue after leg 4 in the flightplan my minutes are off by 1 minute.

If anyone has expierence with this please let me know how to work with this.
kind regards,

formula used for getting the day/time/hour is, please note that I have to convert the initial UInteger value to a double value otherwise all my hours and minutes are off also.

Dim dblX As Double = CDbl(iTime) 'iTime is UInteger from the BGLfile
dblX = dblX / 16777216 * 168
Dim intDay As Integer = Int(dblX / 24)
dblX = (dblX / 24 - CDbl(intDay)) * 24
Dim intHour As Integer = Int(dblX)
dblX = (dblX - intHour) * 60
Dim intMinute As Integer = Int(dblX)
 
Top