Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Synchronizing VB Timer with system time


I'm making a countdown timer, and as you know, the VB timer control doesn't keep accurate time (in seconds). Is there anyway to get the timer in sync with the PC's system time?

Thank you for your time,



  • I can't remember now but there are several API functions that deal with time. So if you're familiar with this use this.

  • If the time count down value sought is a known value (say, 5 seconds), it would seem to me that you could project from the then current System Time(ST), the value of a future System Time (VFST) desired, then have the Timer check: If VFST >= ST then .

  • Just pass the number of seconds you want to delay. Anything greater than 60 will require a check against the minutes. I can expand it to check the minutes if you are interested.

    Sub SecondsDelay(ByVal NumSeconds As Integer)

    StartTime = CInt(Format(Now, "s"))

    Do Until CInt(Format(Now, "s")) = StartTime + NumSeconds



    End Sub

  • Andre YoungAndre Young USAMember Posts: 0

    \ \ free ebooks and video tutorials about // Ruby Python Delphi Visual Basic .NET Scratch C Java Swift C++ Visual Basic MATLAB PL/SQL Objective-C JavaScript Go PHP Assembly R C# Perl F# Bash COBOL Lisp Kotlin Julia Scala Lua Rust Prolog Transact-SQL Apex FoxPro Awk Erlang ABAP SAS Hack Clojure Crystal Alice Dart Ada ML Scheme D Fortran Logo VBScript LabVIEW // _____________

Sign In or Register to comment.