Jump to content
The simFlight Network Forums

Recommended Posts

Posted

Not via offsets. The best you can do is the local time at the players location.

If you use the Airports Database built into the DLL you can get the Lon/Lat of the airport.

With this you can use a NuGet package called GeoTimeZone to get the time zone at that location.

https://github.com/mattjohnsonpint/GeoTimeZone

You can then use another NuGet package called TimeZoneConverter to convert this to the normal .NET TimeZoneInfo class.

https://github.com/mattjohnsonpint/TimeZoneConverter

You can then use that to work out the local time from the UTC Simulator time from the DLL: (FSUIPCConnection.UTCDateTime).

Something like this:

string timeZoneIANA = TimeZoneLookup.GetTimeZone(apLat, apLon).Result;
TimeZoneInfo tzInfo = TZConvert.GetTimeZoneInfo(timeZoneIANA);
DateTime airportLocalTime = TimeZoneInfo.ConvertTimeFromUtc(FSUIPCConnection.UTCDateTime, tzInfo);

Paul

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.