I don't see a problem with this as long as your program doesn't block for more than your timer resolution, and even if it does, your timer won't "lag" cumulatively; it just may miss some updates.
What I would do in a case like this is create my own timer object to keep track of the time with a mechanism to indicate whether the time has changed since the last time the display was updated. That will prevent you from updating your display component every 10 or 100 ms or whatever you use in your Wait loops. Your code will work, but with an object-oriented approach you can store the timer object globally or pass it around to any other functions that need to know the current timer value, or instantiate multiple timer objects in different parts of your code, with only one place in your code that you define the implementation details (e.g. if you want to change to 0.1 sec timer resolution, the changes would be confined to one function).
Here's a simple solution that should do what you want if you're looking for one-second timer resolution:
Function new_TimerClass () As Object
this = {}
this.ts = CreateObject ("roTimespan")
this.prevSeconds = -1
this.start = Function () As Void
m.ts.Mark ()
End Function
this.ticked = Function () As Boolean
ticked = False
seconds = m.ts.TotalSeconds ()
If seconds <> m.prevSeconds
ticked = True
m.prevSeconds = seconds
EndIf
Return ticked
End Function
this.elapsed = Function () As Integer
Return m.ts.TotalSeconds ()
End Function
Return this
End Function
Sub Main ()
timerObj = new_TimerClass ()
timerObj.start ()
port = CreateObject ("roMessagePort")
While True
msg = Wait (100, port)
If timerObj.ticked ()
elapsed = timerObj.elapsed ()
' Update screen component with new elapsed value
Print "New timer tick: "; elapsed
EndIf
End While
End Sub