Results 1 to 3 of 3

Thread: Timegettime Api Negative Value

  1. #1

    Thread Starter
    Lively Member vbLewis's Avatar
    Join Date
    Feb 2009
    Location
    USA
    Posts
    126

    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?

  2. #2
    Frenzied Member
    Join Date
    May 2014
    Location
    Kallithea Attikis, Greece
    Posts
    1,289

    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.

  3. #3

    Thread Starter
    Lively Member vbLewis's Avatar
    Join Date
    Feb 2009
    Location
    USA
    Posts
    126

    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.

    Name:  ss.jpg
Views: 111
Size:  24.3 KB
    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
  •  



Click Here to Expand Forum to Full Width