Set SYSTEMTIME Delay

  • Hello


    I want to set the system time in my application. When I run the code below, it takes up to 15 secs before the touch screen becomes full responsive. It was initially having an effect on my serial port output until I put the setSysteTime code into a seperate thread.


    I have added the Convert.ToUInt16 as a test, initially, I was setting iHours etc as an int and casting it to a ushort - I still got the same delay


    If I remove the setting of the time in my application I do not experience the delay highlighted above.


    Can anyone help with what I am doing wrong?


    Cheers
    Peter


  • I have tested it and the time to set it is at most 11 miliseconds.


    Maybe you use an other function which need some systemtime?
    Please poste your definition of SYSTEMTIME and the SetSystemTime() invoke.

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.

  • Hi


    My SystemTime is
    private struct SYSTEMTIME
    {
    public short wYear;
    public short wMonth;
    public short wDayOfWeek;
    public short wDay;
    public short wHour;
    public short wMinute;
    public short wSecond;
    public short wMilliseconds;
    }


    I have noticed that if I remove the call to
    SetSystemTime(ref SystemTime);
    There is no problem.
    If I display a messagebox immediately after the call it shows up in about 1 second after the call but then the system goes off to think about something else for about 10 seconds or so and the touchscreen in unresponsive for that time. Until I threaded the 'SetSystemTime(ref SystemTime)' it used to have an affect on the comms (which instigates the action).

    My code is finished its action after the call to SetSystemTime(ref SystemTime) and just looks for another instruction on the serial port.


    It may be unrelated but I can no longer connect via USB and active sync. I have uninstalled Active Sync and re istalled and checked the microsoft web site to put the necessary holes in the firewall - still to no avail. I have also tried a different PC - still no connection.


    Do I start another message for this error that I have encountered?


    Cheers
    Peter

  • Hi Peter,
    yes please start an other thread.
    One for the ActiveSync and one for the serial problem.
    Thankx.

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.