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

Get simulated date/season

Messages
2
Country
sweden
Hello !
I need to know the simulated DateTime to calculate an estimated daylight factor.
I have found the time via SimConnect_AddToDataDefinition(hSimConnect, DEFINITION_1, "ZULU TIME", "Seconds");

But I ask for help how to get any data to calculate the day of year (season) ?
 
Hi Lennart,

The time/date variables are documented but in a "strange" place, where are are called "Environment Variables":
<https://docs.flightsimulator.com/ht...erse_Polish_Notation.htm#EnvironmentVariables>

From here you can see that "ZULU TIME" is only seconds from start of current day.

"ABSOLUTE TIME" could be used as a base for calculations of actual current time (eg. `Date("1/1/1") + absolute time seconds`). Or use one of the other available variables, perhaps "ZULU DAY OF YEAR" is all you need.

HTH,
-Max
 
Hi Lennart,

The time/date variables are documented but in a "strange" place, where are are called "Environment Variables":
<https://docs.flightsimulator.com/ht...erse_Polish_Notation.htm#EnvironmentVariables>

From here you can see that "ZULU TIME" is only seconds from start of current day.

"ABSOLUTE TIME" could be used as a base for calculations of actual current time (eg. `Date("1/1/1") + absolute time seconds`). Or use one of the other available variables, perhaps "ZULU DAY OF YEAR" is all you need.

HTH,
-Max
Thanks a lot, the "strange" place did the trick, since it has ZULU SUNRISE TIME and ZULU SUNSET TIME, I can very easy together with just ZULU TIME calculate a sunlight factor.
 
Hi Lennart,

The time/date variables are documented but in a "strange" place, where are are called "Environment Variables":
<https://docs.flightsimulator.com/ht...erse_Polish_Notation.htm#EnvironmentVariables>

From here you can see that "ZULU TIME" is only seconds from start of current day.

"ABSOLUTE TIME" could be used as a base for calculations of actual current time (eg. `Date("1/1/1") + absolute time seconds`). Or use one of the other available variables, perhaps "ZULU DAY OF YEAR" is all you need.

HTH,
-Max
Hi Max,

Is it possible to get notified by SimConnect when user changes date/time in-game, in-UI?

Thanks!
 
Is it possible to get notified by SimConnect when user changes date/time in-game, in-UI?

Hi Misho, if you subscribe to them like other Sim Vars (`RequestDataOnSimObject()`, not `RequestDataOnSimObjectType()`) then the sim should "push" the changes to you regardless of how they're made (time actually passing or user changing it). With the latter function you have to poll the sim for changes, of course, but you should still get updated values, assuming sim time is passing at all.

Though to be honest I haven't verified that exact scenario as far as I can remember. I know the time variables get updated while sim is running, so I'm assuming user-induced changes would be reported the same way. So if it doesn't do that then I would consider it a bug... :)

BTW, the "strange place" for the docs has been passed onto Asobo and prompted a couple missions to find them... 😆
<https://devsupport.flightsimulator....tion-variables-docs-for-simconnect-users/6673>

Cheers,
-Max
 
Hi Misho, if you subscribe to them like other Sim Vars (`RequestDataOnSimObject()`, not `RequestDataOnSimObjectType()`) then the sim should "push" the changes to you regardless of how they're made (time actually passing or user changing it). With the latter function you have to poll the sim for changes, of course, but you should still get updated values, assuming sim time is passing at all.

Though to be honest I haven't verified that exact scenario as far as I can remember. I know the time variables get updated while sim is running, so I'm assuming user-induced changes would be reported the same way. So if it doesn't do that then I would consider it a bug... :)

BTW, the "strange place" for the docs has been passed onto Asobo and prompted a couple missions to find them... 😆
<https://devsupport.flightsimulator....tion-variables-docs-for-simconnect-users/6673>

Cheers,
-Max
Thanks Max!

Yes, definitely, I could keep track of time, set up a sim 4HZ polling of time, then compare if my time is off compared to sim time, and if it is, call that a "TIME CHANGE" event by user. And, set something up to ignore it if the sim is not in flight mode, but in "UI" mode....

But man, does that seem awkward. I think back in FSX and P3D days, every time there was a UI time change, a sim would be saved and loaded into a temporary FLT file, and that event would be registered, so I would compare time stamp on SAVE FLT and LOAD FLT and see if the user changed time.

But now in MSFS2020, time is changed dynamically, without a reload, and that makes it a bit trickier.
 
Hi Misho,

I guess I'm not really sure or don't understand what you mean or are trying to do...

I just did a test, requesting (subscribing to) "ABSOLUTE TIME" and "ZULU TIME" vars via SimConnect (`RequestDataOnSimObject()`). They change in "real time" with whatever is happening in the sim... even if I go in and start changing the time in the World Map flight setup, the new/changed time is sent right away. And same when I'm in a flight and change the current date/time via UI.

So that seems to work as expected, at least. Does that help with what you're trying to do?

Cheers,
-Max
 
Hi Misho,

I guess I'm not really sure or don't understand what you mean or are trying to do...

I just did a test, requesting (subscribing to) "ABSOLUTE TIME" and "ZULU TIME" vars via SimConnect (`RequestDataOnSimObject()`). They change in "real time" with whatever is happening in the sim... even if I go in and start changing the time in the World Map flight setup, the new/changed time is sent right away. And same when I'm in a flight and change the current date/time via UI.

So that seems to work as expected, at least. Does that help with what you're trying to do?

Cheers,
-Max
Right - but that is a variable. You can subscribe to it and poll it and get the value. What I'd like to know is when a user CHANGES the time, as in, an event when user selects the new time/date/year from the in-game UI.
 
Back
Top