• 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.

FSX Real Life Time

Kekelekou

Resource contributor
Messages
226
Country
france
Hello !


For a very simple maintenance gauge, I would like to know if the real world time is “retrievable” though an environment variable in the FSX world ?

I have read the simulation variable page of the SDK, and the only thing close to my need is P:AbsoluteTime, which would return the time in the sim, not the real world one… There must be a way, since FSX can synchronise the sim to the RL.


Any help appreciated!
 
There's no way to read the current real-world time from XML. SimConnect could be possible though.

For what do you want the current time?
 
Hi Heretic,
I would like to create gauge that locks a plane (kills the starter or fuel valve eg) for a few "real" days, , to simulate an engine overhaul or any maintenance for a damage mod I have been working on. If repairing a damaged engine takes no time, there is little point trying to keep wear to the minimum.
Well, where to start with SimConnect?
 
I'm not familiar with SimConnect, but in XML, I would simply trap the time at which the overhaul begins...

Code:
(L:Plane Is Locked, bool) !
(L:Overhaul Is Started, bool) and
if{ (P:AbsoluteTime, seconds) (>L:Overhaul Start Time, number) 1 (>L:Plane Is Locked, bool) }

...put these variables into a load/save gauge like Doug Dawson's XML Config gauge or XMLTools' Logger to keep the values across FSX sessions and unlock the plane after a certain time has elapsed.

Code:
<!-- 2 days = 3600 seconds/hour * 48 hours = 172800 seconds -->
(P:AbsoluteTime, seconds) (L:Overhaul Start Time, number) 172800 + &gt;
(L:Plane Is Locked, bool) and
if{ 0 (>L:Overhaul Is Started, bool) 0 (>L:Overhaul Start Time, number) 0 (>L:Plane Is Locked, bool) }

The actual systems interaction with the starter or mixture or something like that should be easy to do.

(I would be pretty upset if my favourite sim aircraft was locked for a few days straight though. ;)
To give maintenance some purpose other than loking it up straight away, I've tied it to money, failures and pilot/airline ratings in MIT.)
 
Simconnect is not necessary.

But you would need to create a C gauge to read the current computer system time and then send that to an L:var. I have to assume you are using a C gauge already (or you will need to start using one) as how else will you save your maintenance and wear data?

You can use the GetLocalTime function which will return the UTC time:
https://msdn.microsoft.com/en-us/li...338(v=vs.85).aspx?f=255&MSPPError=-2147217396

Here's a simple bit of code I use to retrieve milliseconds:

Code:
SYSTEMTIME lt; // Structure is defined here https://msdn.microsoft.com/en-us/library/windows/desktop/ms724950%28v=vs.85%29.aspx

GetLocalTime(&lt);
previous_systime = systime;
systime = lt.wMinute * 60000 + lt.wSecond * 1000 + lt.wMilliseconds;

You can then use an execute calculator code function to send it to an L:var.
 
Hello Anthony,

I am simply ajusting Ismail Hakki Güzel's Damage Mod which uses Doug Dawson "data saving" gauge. So I have not been down the C road so far. XML is challenging enough for me!
But your idea is really appealing
 
maybe I haven't understood your request, but you can get Greenwich time in XML:

(P:ZULU TIME,hours) flr 100 % gives hours

(P:ZULU TIME,minutes) flr 60 % gives minutes
 
Back
Top