-
Jan 13th, 2022, 07:06 PM
#1
Thread Starter
Lively Member
Timegettime Api Negative Value
My matrix screensaver that i made back in the windows Xp days and have been using for years suddenly stopped working a few days (weeks?) ago. I discovered it is because the timegettime API call I used to calculate tick durations is returning large negative integers.
Questions:
1) Is this happening to anyone else or is it just my system?
2) What would be an easy way to deal with this?
Edit: Would something such as Abs(timeGettime) be a simple fix?
-
Jan 13th, 2022, 07:32 PM
#2
Re: Timegettime Api Negative Value
I found it one time in Windows 10 (maybe I had the pc in hibernation for a long time)
Function uintnew(ByVal a As Currency) As Currency
If a > 2147483647@ Then a = 2147483647@
If a < -2147483648@ Then a = -2147483648@
If a < 0 Then
uintnew = 4294967296@ + a
Else
uintnew = a
End If
End Function
then use uintnew(CCur(timeGetTime)) so every time you get unsigned integer.
This is good you get result 1
? uintnew(&H80000000&)-uintnew(&H7FFFFFFF&)
This is an error (overflow)
? &H80000000&-&H7FFFFFFF&
Last edited by georgekar; Jan 13th, 2022 at 07:40 PM.
-
Jan 13th, 2022, 08:00 PM
#3
Thread Starter
Lively Member
Re: Timegettime Api Negative Value
thanks george. Im guessing double would also work as a data type.
After adding your function and changing some data types all is good again, we take the red pill.
Last edited by vbLewis; Jan 13th, 2022 at 10:55 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|