Keeping Accurate Time

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • I'm working on a small application that needs to maintain accurate time - the reason being, is this application actually allows different functionality based on the current time of day.

    I've created 4 Global Values:
    Global_HundSecs
    Global_Seconds
    Global_Minutes
    Global_Hours

    At the start of the application, I set the above Global Values to retrieve their respective value from the Date/Time object.
    This stamps the application with the exact time that the application was started.

    From that point on, I've setup a timer and some variables to keep the time going - that way I don't have to constantly ask the Date/Time object what time it is.
    Something to the effect of:

    Every 1/100 of a second, add 1 to Global_HundSecs.
    If Global_HundSecs = 100, add 1 to Global_Seconds, and set Global_HundSec to 0.
    If Global_Seconds = 60, add 1 to Global_Minutes, and set Global_Seconds to 0.
    If Global_Minutes = 60, add 1 to Global_Hours, and set Global_Minutes to 0.
    If Global_Hours = 25, set Global_Hours to 0.

    So, the above code should keep the time going.

    To test my code to make sure it works accurately, I test the current in-app time agains the current system time retrieved from the Date/Time object.
    The calculations are off - making my in-app clock run slower than my system clock.

    Any thoughts?

  • Regardless of any timer seconds, the application can only run so fast. If you have having the value incremented every 1/100 second but your application is running that fast, the event will not execute.

    The events will only execute as fast as the entire application is acting.


    Summary

    Even though you are saying "Every 1/100 second" the application will only execute that condition as fast as it can, whether that be "Every 1/100 second" or "Every 5/100 second," etc...

    • Please login to see this link.

    Please login to see this picture.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!