1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Want to set FSX time via Simconnect

Discussion in 'SimConnect' started by veldthui, 19/1/08.

  1. veldthui

    veldthui

    Joined:
    19/1/08
    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
  2. Pete Dowson

    Pete Dowson

    Joined:
    25/9/06
    Messages:
    315
    Country:
    unitedkingdom
    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
  3. Michael Garbers

    Michael Garbers

    Joined:
    26/1/08
    Messages:
    20
    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
  4. Pete Dowson

    Pete Dowson

    Joined:
    25/9/06
    Messages:
    315
    Country:
    unitedkingdom
    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:

    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.

    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
  5. Michael Garbers

    Michael Garbers

    Joined:
    26/1/08
    Messages:
    20
    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: 27/1/08
  6. veldthui

    veldthui

    Joined:
    19/1/08
    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)
  7. Geoff_D

    Geoff_D

    Joined:
    5/2/07
    Messages:
    359
    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
  8. veldthui

    veldthui

    Joined:
    19/1/08
    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.
  9. GOIT.com.pl

    GOIT.com.pl

    Joined:
    30/11/14
    Messages:
    14
    Country:
    poland
    Does someone resolve this problem?

Share This Page