View previous topic :: View next topic |
Author |
Message |
DanRRight
Joined: 10 Mar 2008 Posts: 2819 Location: South Pole, Antarctica
|
Posted: Sat Apr 19, 2008 9:27 am Post subject: CALL SYSTEM_CLOCK problem |
|
|
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? |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7927 Location: Salford, UK
|
Posted: Sat Apr 19, 2008 3:38 pm Post subject: |
|
|
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. |
|
Back to top |
|
|
DanRRight
Joined: 10 Mar 2008 Posts: 2819 Location: South Pole, Antarctica
|
Posted: Sat Apr 19, 2008 10:51 pm Post subject: |
|
|
Is it worth to get newer version of Salflibc (mine are ~5 years old) ? |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7927 Location: Salford, UK
|
Posted: Sun Apr 20, 2008 8:34 am Post subject: |
|
|
No I don't think it will make any difference. |
|
Back to top |
|
|
JohnCampbell
Joined: 16 Feb 2006 Posts: 2554 Location: Sydney
|
Posted: Tue Apr 22, 2008 3:20 am Post subject: |
|
|
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 |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7927 Location: Salford, UK
|
Posted: Tue Apr 22, 2008 7:01 am Post subject: |
|
|
Thanks. I will take another look at this as soon as I can. |
|
Back to top |
|
|
|