Silverfrost Forums

Welcome to our forums

CALL SYSTEM_CLOCK problem

19 Apr 2008 8:27 #3040

In my new computer I got one annoyance. Now the code does not give me correct time obtained this way

    CALL SYSTEM_CLOCK (iclock,irate)
    SecondsSinceTheMidnight = iclock/dble(irate)

And time goes back! I mean SecondsSinceTheMidnight decreasing all the way

What could be wrong?

19 Apr 2008 2:38 #3044

Problems with SYSTEM_CLOCK have been reported on some machines but so far I have not been able to reproduce this or make any progress towards a fix.

19 Apr 2008 9:51 #3046

Is it worth to get newer version of Salflibc (mine are ~5 years old) ?

20 Apr 2008 7:34 #3048

No I don't think it will make any difference.

22 Apr 2008 2:20 #3064

Paul,

There is a requirement for integer*8 variables to solve this as the count_rate in some processors is > 2^31, ie -ve. On my 3ghz P4 the count_rate was 3ghz. system_clock should be changed to detect when count_rate is not a good value.

You can work around the problem by recognising the time step is going backwards and calculate the -ve factor to apply to the time coming out of SYSTEM_CLOCK. I did and it worked fine for that pc only.

My solution is to use an alternative routine. I use :-

! ELAPSED TIME CALLS ! fastest gettickcount winapi ! accurate QueryPerform winapi !
! CPU TIME CALLS ! fastest cpu_clock@ salford ! accurate cpu_clock@ salford

John

22 Apr 2008 6:01 #3066

Thanks. I will take another look at this as soon as I can.

Please login to reply.