' Timer and benchmarking: TIMER, DELAY, TIMER for performance measurement
#COMPILE EXE
#DIM ALL

FUNCTION PBMAIN() AS LONG
    LOCAL t1  AS LONG
    LOCAL t2  AS LONG
    LOCAL tix1  AS LONG
    LOCAL tix2  AS LONG
    LOCAL i  AS LONG
    LOCAL sum  AS LONG
    t1 = TIMER
    tix1 = TIMER

    sum = 0
    FOR i = 1 TO 100000
        sum = sum + i
    NEXT i

    t2 = TIMER
    tix2 = TIMER

    PRINT "Sum result:"; sum
    PRINT "TIMER elapsed (ms):"; t2 - t1
    PRINT "TIMER elapsed:"; tix2 - tix1
    PRINT "TIMER precision test complete."

    FUNCTION = 0
END FUNCTION
