home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 2281 < prev    next >
Encoding:
Text File  |  1996-08-05  |  2.2 KB  |  123 lines

  1. Path: news.staffs.ac.uk!bs47c!cm4bctrd
  2. From: cm4bctrd@bs47c.staffs.ac.uk (Wildfire)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Problem with clock() with SAS 6.3
  5. Date: 29 Jan 1996 18:45:37 GMT
  6. Organization: Staffordshire University
  7. Message-ID: <4ej4kh$nkf@bs33n.staffs.ac.uk>
  8. NNTP-Posting-Host: bs47c.staffs.ac.uk
  9. X-Newsreader: TIN [version 1.2 PL2]
  10.  
  11. Hi all :-)
  12.  
  13. Well, I've a problem.  I guess you've figured that out, otherwise I wouldn't
  14. be posting this, right? Right :-)
  15.  
  16. Anyways, here's the deal.
  17.  
  18. I want to use the clock() function.  (In an LRU algorithm, `case you were
  19. curious :-)
  20.  
  21. But I'm getting screwy results.
  22.  
  23. Here's some sample code, and the output I get.
  24.  
  25. #include <stdio.h>
  26. #include <stdlib.h>
  27. #include <time.h>
  28.  
  29. int main()
  30. {
  31.     unsigned int
  32.         loop;
  33.  
  34.     clock_t
  35.         time;
  36.  
  37.     for( loop = 0 ; loop < 50 ; loop++ )
  38.     {
  39.         if( (clock_t) -1 == ( time = clock() ) )
  40.         {
  41.             printf( "%u. no time available.\n", loop );
  42.         }
  43.         else
  44.         {
  45.             printf( "%u. %d\n", loop, (int)time );
  46.         }
  47.     }
  48.  
  49.     return( EXIT_SUCCESS );
  50. }
  51.  
  52. And this is what I get...
  53.  
  54. 0. 2
  55. 1. 58
  56. 2. 134
  57. 3. 190
  58. 4. 262
  59. 5. 318
  60. 6. 395
  61. 7. 451
  62. 8. 4295491
  63. 9. 4295547
  64. 10. 4295619
  65. 11. 4295676
  66. 12. 4295748
  67. 13. 4295807
  68. 14. 4295880
  69. 15. 4295936
  70. 16. 1042
  71. 17. 1097
  72. 18. 1170
  73. 19. 1225
  74. 20. 1298
  75. 21. 1353
  76. 22. 1427
  77. 23. 4296453
  78. 24. 4296528
  79. 25. 4296584
  80. 26. 4296660
  81. 27. 4296716
  82. 28. 4296788
  83. 29. 4296844
  84. 30. 4296918
  85. 31. 2006
  86. 32. 2078
  87. 33. 2134
  88. 34. 2207
  89. 35. 2261
  90. 36. 2334
  91. 37. 2390
  92. 38. 4297434
  93. 39. 4297507
  94. 40. 4297580
  95. 41. 4297636
  96. 42. 4297708
  97. 43. 4297764
  98. 44. 4297837
  99. 45. 4297895
  100. 46. 3003
  101. 47. 3059
  102. 48. 3146
  103. 49. 3200
  104.  
  105. *akkk!*
  106.  
  107. Now, I posted about this a year or so ago, and got a reply from the guy who
  108. actually coded this function.  If you're reading, a BIG sorry.  I wanted to
  109. answer but things just kept coming up and it never got done.  *Sorry*.
  110.  
  111. Anyways.  Can anyone help! =-)
  112.  
  113. Wildfire :-)
  114.  
  115. -----------------------------------------------------------------------------
  116. "Oh God could it be the weather? - oh God - why am I here?  If love isn't 
  117. forever...and it's not the weather...*whisper* - hand me my leather..."
  118.  
  119. Member of the AEL fan club :-)
  120.  
  121. Knight of The Rose, loyal follower of The Sea...(mud.veda.is 4000)
  122. -----------------------------------------------------------------------------
  123.