• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

FSXA How to convert in .NET

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