home *** CD-ROM | disk | FTP | other *** search
- Path: news.staffs.ac.uk!bs47c!cm4bctrd
- From: cm4bctrd@bs47c.staffs.ac.uk (Wildfire)
- Newsgroups: comp.sys.amiga.programmer
- Subject: Problem with clock() with SAS 6.3
- Date: 29 Jan 1996 18:45:37 GMT
- Organization: Staffordshire University
- Message-ID: <4ej4kh$nkf@bs33n.staffs.ac.uk>
- NNTP-Posting-Host: bs47c.staffs.ac.uk
- X-Newsreader: TIN [version 1.2 PL2]
-
- Hi all :-)
-
- Well, I've a problem. I guess you've figured that out, otherwise I wouldn't
- be posting this, right? Right :-)
-
- Anyways, here's the deal.
-
- I want to use the clock() function. (In an LRU algorithm, `case you were
- curious :-)
-
- But I'm getting screwy results.
-
- Here's some sample code, and the output I get.
-
- #include <stdio.h>
- #include <stdlib.h>
- #include <time.h>
-
- int main()
- {
- unsigned int
- loop;
-
- clock_t
- time;
-
- for( loop = 0 ; loop < 50 ; loop++ )
- {
- if( (clock_t) -1 == ( time = clock() ) )
- {
- printf( "%u. no time available.\n", loop );
- }
- else
- {
- printf( "%u. %d\n", loop, (int)time );
- }
- }
-
- return( EXIT_SUCCESS );
- }
-
- And this is what I get...
-
- 0. 2
- 1. 58
- 2. 134
- 3. 190
- 4. 262
- 5. 318
- 6. 395
- 7. 451
- 8. 4295491
- 9. 4295547
- 10. 4295619
- 11. 4295676
- 12. 4295748
- 13. 4295807
- 14. 4295880
- 15. 4295936
- 16. 1042
- 17. 1097
- 18. 1170
- 19. 1225
- 20. 1298
- 21. 1353
- 22. 1427
- 23. 4296453
- 24. 4296528
- 25. 4296584
- 26. 4296660
- 27. 4296716
- 28. 4296788
- 29. 4296844
- 30. 4296918
- 31. 2006
- 32. 2078
- 33. 2134
- 34. 2207
- 35. 2261
- 36. 2334
- 37. 2390
- 38. 4297434
- 39. 4297507
- 40. 4297580
- 41. 4297636
- 42. 4297708
- 43. 4297764
- 44. 4297837
- 45. 4297895
- 46. 3003
- 47. 3059
- 48. 3146
- 49. 3200
-
- *akkk!*
-
- Now, I posted about this a year or so ago, and got a reply from the guy who
- actually coded this function. If you're reading, a BIG sorry. I wanted to
- answer but things just kept coming up and it never got done. *Sorry*.
-
- Anyways. Can anyone help! =-)
-
- Wildfire :-)
-
- -----------------------------------------------------------------------------
- "Oh God could it be the weather? - oh God - why am I here? If love isn't
- forever...and it's not the weather...*whisper* - hand me my leather..."
-
- Member of the AEL fan club :-)
-
- Knight of The Rose, loyal follower of The Sea...(mud.veda.is 4000)
- -----------------------------------------------------------------------------
-