When you find out that a function that 95% of your code relies on craps out after 24ish days.

I didn't know it worked like that.

The nuts and bolts of it is that my program throws up random events.

An early problem was sometimes it would throw up the same random event a very short time to the last time.

So I put timers in them to indicate how long they had to wait before they could occur again. If it got called before that it skipped out.

Then ALL events suddenly stopped working in my program at the same time.

When I checked it, I found that GetTickCount was return -2 billion something or other.

What that meant was that every event called skipped out because the interval was less than the requirement.

I've fixed it but wow... it's all over my code and now a lot to fix.

In 30 something years of VB6 I've never run into this before. But I don't think I've ever run any of my code for 24 days straight either.

Offending Code:

Code:
Public Property Get EventElapsedSeconds(ByRef EventStartingTicks As Long) As Double

EventElapsedSeconds = CDbl((GetTickCount - EventStartingTicks)) / 1000

End Property
Example of how it was called:

Code:
Private Function Random05() As Long
Static nTickcount As Long

If EventElapsedSeconds(nTickcount) < 60 Then Exit Function

ShowGamePlayNotes

nTickcount = GetTickCount

End Function
The nice thing about that code was that I could return fractions of a second. That didn't come up often but there are a few cases.

So my fix won't have the GetTickCount problem but it only returns whole seconds (I think).

Code:
Public Property Get ElapsedSeconds(ByRef FromDate As Date) As Double

If (FromDate = "00:00:00") Or (FromDate > Now()) Then FromDate = Now() ' FromDate is not Initialized.

ElapsedSeconds = DateDiff("s", FromDate, Now())

End Property
Called as thus:

Code:
Private Function Random05() As Long
Static dLastEvent As Date

If ElapsedSeconds(dLastEvent) < 60 Then Exit Function

ShowGamePlayNotes

dLastEvent = Now()

End Function