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

Want to set FSX time via Simconnect

Messages
7
Country
newzealand
Okay I have Simconnect up and running fine using VB.NET and can read values I want fine.
Now as part of a program I am tinkering with I would like to be able to set the FSX current UTC time by clicking on a button on my application. I am not quite sure where to begin as the examples I have seen are a bit not that clear to me.
Any help or pointers to example code would be much appreciated.

John Veldthuis
 
Messages
317
Country
unitedkingdom
I would like to be able to set the FSX current UTC
You send a Sim Event. Check these SimConnect functions:

SimConnect_MapClientEventToSimEvent
and
SimConnect_TransmitClientEvent

The events relating to Time setting are:

CLOCK_SECONDS_ZERO Zeros seconds
CLOCK_HOURS_SET Sets hour of day
CLOCK_MINUTES_SET Sets minutes of the hour
ZULU_HOURS_SET Sets hours, zulu time
ZULU_MINUTES_SET Sets minutes, in zulu time
ZULU_DAY_SET Sets day, in zulu time
ZULU_YEAR_SET

where all you need to know is ZULU = UTC.

Regards

Pete
 
Messages
30
Country
germany
Hi John and Pete,

I have the same problem.
Normal events without parameter are working. (Like PAUSE_ON)

But setting a value e.g. ZULU_HOURS_SET doesn't seem to work.

fsx_simconnect.MapClientEventToSimEvent(EVENTTIME_ID.ZULU_HOURS_SET, "ZULU_HOURS_SET")
fsx_simconnect.AddClientEventToNotificationGroup(GROUPTIME_ID.GROUP_TIME, EVENTTIME_ID.ZULU_HOURS_SET, False)
fsx_simconnect.SetNotificationGroupPriority(GROUPTIME_ID.GROUP_TIME, SimConnect.SIMCONNECT_GROUP_PRIORITY_STANDARD)

:
:
:
Dim uValue As UInteger
uValue = 0
fsx_simconnect.TransmitClientEvent(SimConnect.SIMCONNECT_OBJECT_ID_USER, EVENTTIME_ID.ZULU_HOURS_SET, uValue, GROUPTIME_ID.GROUP_TIME, SIMCONNECT_EVENT_FLAG.DEFAULT)

This doesn't make any effect.

Any idea?
Micha
 
Messages
317
Country
unitedkingdom
But setting a value e.g. ZULU_HOURS_SET doesn't seem to work.
Have you checked the SimConnect log? The answers are often there. The controls do work from FSUIPC4 (if you have a registered copy you can assign them, with parameter, and test them -- then compare what's in the SimConnect log with what you get).

Two other suggestions:

fsx_simconnect.SetNotificationGroupPriority(GROUPTIME_ID.GROUP_TIME, SimConnect.SIMCONNECT_GROUP_PRIORITY_STANDARD)

I found some things (not sure which) don't get to the right part of FSX unless you have a higher priority (i.e. lower number), so I send all mine with that last parameter as
SIMCONNECT_GROUP_PRIORITY_STANDARD-1.

Probably won't make any difference here, but worth a try.

fsx_simconnect.TransmitClientEvent(SimConnect.SIMCONNECT_OBJECT_ID_USER, EVENTTIME_ID.ZULU_HOURS_SET, uValue, GROUPTIME_ID.GROUP_TIME, SIMCONNECT_EVENT_FLAG.DEFAULT)

Now here I am pretty sure you should be using
SIMCONNECT_SIMOBJECT_TYPE_USER
in place of
SIMCONNECT_OBJECT_ID_USER

The "user object" is his aircraft. Time is an environmental setting, so maybe there's the difference? I use SIMCONNECT_SIMOBJECT_TYPE_USER for all transmitted events except for those specific to AI aircraft.

This was confusing right from the start, by the way. Once finding something that worked, I stuck to it without inquiring too much deeper! ;-)

Regards

Pete
 
Messages
30
Country
germany
Hi Pete,

thank you for your help.

Your last comment on the enumberation was correct. :)

By the way, I do the same. If it is working I don't spend much care of it anymore.

Now I just have to figure out why the AIObject placement doesn't like rotorcraft but normal aircraft. Well, that's a total different story.

Best,
Micha
 
Last edited:
Messages
7
Country
newzealand
Well I just cant get it working. The program is certainly sending data through as it appears in the debug window but the UTC time just does not change.


In my initiate section I have.

fsx_simconnect.MapClientEventToSimEvent(ZEVENTS.ZULU_YEAR, "ZULU_YEAR_SET")
fsx_simconnect.MapClientEventToSimEvent(ZEVENTS.ZULU_DAY, "ZULU_DAY_SET")
fsx_simconnect.MapClientEventToSimEvent(ZEVENTS.ZULU_HOURS, "ZULU_HOURS_SET")
fsx_simconnect.MapClientEventToSimEvent(ZEVENTS.ZULU_MINUTES, "ZULU_MINUTES_SET")
fsx_simconnect.AddClientEventToNotificationGroup(EGROUP.ZHOURS, ZEVENTS.ZULU_HOURS, False)
fsx_simconnect.AddClientEventToNotificationGroup(EGROUP.ZHOURS, ZEVENTS.ZULU_MINUTES, False)
fsx_simconnect.SetNotificationGroupPriority(EGROUP.ZHOURS, SimConnect.SIMCONNECT_GROUP_PRIORITY_DEFAULT - 1)

And to try and set the time I use

Dim mytime As Date
Dim mhours As UInteger
Dim mminutes As UInteger

mytime = Date.UtcNow
mhours = CUInt(mytime.Hour)
mminutes = CUInt(mytime.Minute)

'Set ZULU hours
fsx_simconnect.TransmitClientEvent(CUInt(SIMCONNECT_SIMOBJECT_TYPE.USER), ZEVENTS.ZULU_HOURS, mhours, SimPri.SIMCONNECT_GROUP_PRIORITY_DEFAULT, SIMCONNECT_EVENT_FLAG.GROUPID_IS_PRIORITY)

'Set ZULU minutes
fsx_simconnect.TransmitClientEvent(CUInt(SIMCONNECT_SIMOBJECT_TYPE.USER), ZEVENTS.ZULU_MINUTES, mminutes, SimPri.SIMCONNECT_GROUP_PRIORITY_DEFAULT, SIMCONNECT_EVENT_FLAG.GROUPID_IS_PRIORITY)
 
Messages
497
Country
unitedstates
You do not specify if you are trying to change time in a FREE FLYING session or a MULTIPLAYER session.

I am assuming you are talking FREE FLYING.

However, if you are in fact talking about changing time in a Multiplayer Session, then this is a very different thing, and setting the LOCAL or ZULU time by the methods mentioned earlier in this post will NOT effect a permanent time change.

Within a few seconds, time will be reset back to the original time, before you made the simconnect calls. :confused:

This applies to trying to set the time on either the HOSTING computer OR any of the Client computers.

If anyone has figureed ot a way to change the time of a "running" Multiplayer session, please share the information.:idea:

From what I have deduced (assumed) over the past year, there must be another SIM TIME clock running in the simulator during a Multiplayer session, that originaly gets set to the Hosts's specified Multiplayer Session time, and then "Free Runs".( possibly being constantly re-syned on Clinet compouters to the Host's computer ??) If this additional clock does really exist, I have seen no official mention of it, and there is obviouly no documented simconnect function to read or set it.

Geoff_D
 
Messages
7
Country
newzealand
What I am trying to do is set the Free Flying time. I want to set it to UTC or local depending on which button is clicked. Thought I would try it with UTC first just to get it working.

I would like to be able to set it via my program just as though it was set just before the flight in the World Menu.

I have tried quite a few things. I can read all the times perfectly that I want to affect, just cant change them.
 

KWB

Messages
69
Country
germany
I can only confirm that this works for me (sets the time)

hr+=SimConnect_TransmitClientEvent(m_hSimConnect,0,EventSetTimeZuluHours,h,SIMCONNECT_GROUP_PRIORITY_STANDARD,SIMCONNECT_EVENT_FLAG_GROUPID_IS_PRIORITY);
hr+=SimConnect_TransmitClientEvent(m_hSimConnect,0,EventSetTimeZuluMinutes,m,SIMCONNECT_GROUP_PRIORITY_STANDARD,SIMCONNECT_EVENT_FLAG_GROUPID_IS_PRIORITY);
 
Top