BarryG wrote: Fri Aug 08, 2025 5:21 am
GetTickCount_() doesn't work after 49.7 days of uptime, so it's not usable for this sort of thing. Microsoft says to use GetTickCount64() instead, but that's not immediately available in PureBasic as a single API command. Someone else here will surely step in and show how to use it.
Hi BarryG. once again you are quite correct. And yes someone did share the cetTickCount64() solution so I am posting the sample code here that I saved previously and leave it at that. Enough sample code here now for someone else to put the pieces together if they want it bad enough:
jacdelad wrote: Fri Aug 08, 2025 4:17 pm
Just read the first sentence Randy wrote. The uptime if his program. Period.
Okay. My bad.
Randy Walker wrote: Sat Aug 09, 2025 12:14 amI could be wrong but I think it has the same limitation as GetTickCount_()
Otherwise, yes, You could substitute using ElapsedMilliseconds()
ElapsedMilliseconds() is a Quad, so doesn't have the same 49.7 day limit as GetTickCount_(), which is a Word.
You can just use Date() like my previous post shows (viewtopic.php?p=643842#p643842), and avoid "Prototype GetTickCount64()" altogether. Why add extra code that isn't needed?
jacdelad wrote: Fri Aug 08, 2025 4:17 pm
Just read the first sentence Randy wrote. The uptime if his program. Period.
Okay. My bad.
Randy Walker wrote: Sat Aug 09, 2025 12:14 amI could be wrong but I think it has the same limitation as GetTickCount_()
Otherwise, yes, You could substitute using ElapsedMilliseconds()
ElapsedMilliseconds() is a Quad, so doesn't have the same 49.7 day limit as GetTickCount_(), which is a Word.
Well OK then. Good clarification.
You can just use Date() like my previous post shows (viewtopic.php?p=643842#p643842), and avoid "Prototype GetTickCount64()" altogether. Why add extra code that isn't needed?
You're right! Date() is also a great solution. Tips beget tips. Thank again BarrtG!!
- - - - - - - - - - - - - - - -
Randy
I *never* claimed to be a programmer.
App runtime is: 01/00:00:01
App runtime is: 01/00:00:02
App runtime is: 01/00:00:03
App runtime is: 01/00:00:04
App runtime is: 01/00:00:05
App runtime is: 01/00:00:06
App runtime is: 01/00:00:07
App runtime is: 01/00:00:08
App runtime is: 01/00:00:09
It still is erroneously adding an extra day.
- - - - - - - - - - - - - - - -
Randy
I *never* claimed to be a programmer.
Randy Walker wrote: Sat Aug 09, 2025 5:52 pm
Ok BarryG... Like I said at the start FormatDate failed me same as it does with your code, modified to in iclude %dd
App runtime is: 01/00:00:01
App runtime is: 01/00:00:02
App runtime is: 01/00:00:03
App runtime is: 01/00:00:04
App runtime is: 01/00:00:05
App runtime is: 01/00:00:06
App runtime is: 01/00:00:07
App runtime is: 01/00:00:08
App runtime is: 01/00:00:09
It still is erroneously adding an extra day.
Date() Returns an accurate time in seconds that can be used as a start time value and also to calculate the time difference in seconds (timeDifference = currentTime - startTime).
FormatDate() is inadequate for displaying elapsed time because it is tailored for displaying dates. So days range from 1 - 31 and hours from 0 to 23, etc.
You have to use your own routine to display the time elapsed like others have shared earlier in this thread.
HeX0R wrote: Sat Aug 09, 2025 8:46 pm
here is another one
Uhhh, But for some reason yours is ahowing 4/ days plus the tick up. This wont work either.
The reason is, you are using an older PB version and your PC is since 4 days on.
That's amazing how you deduce that, How? PC was up 4 days+ and I was testing on PB ver5.40
Hexor is amazing but Sherlock would tell you that the deduction was an elementary process in light of the facts that prior to PureBasic v5.60, ElapsedMilliseconds() returned values based on the uptime of the computer. In v5.60 and later it, ElapsedMilliseconds() returned a value of zero on the first call and the elapsed time on subsequent calls.
Thus Hexor reached the only conclusion that was reachable given the time he posted the code sample and how soon you posted your results that exceed 4 days time.