gettickcount or gettime -
PepsiCola23 - 12.02.2018
as the title says,which one`s better to use for a command that can be used every 6 hours?
Re: gettickcount or gettime -
Mugala - 12.02.2018
gettickcount of course.
Re: gettickcount or gettime -
Dayrion - 12.02.2018
Quote:
Originally Posted by Mugala
gettickcount of course.
|
Why?
Re: gettickcount or gettime -
PepsiCola23 - 12.02.2018
some people recommended gettime for the things more than a second because it returns the time in seconds.
i just wanted to hear more thoughts about this
Re: gettickcount or gettime -
Abagail - 12.02.2018
GetTickCount should be fine for use, although it won't persist properly across server restarts/crashes as the count will reset. If you save the value, use gettime.
Re: gettickcount or gettime -
Dayrion - 12.02.2018
Quote:
Originally Posted by Abagail
GetTickCount should be fine for use, although it won't persist properly across server restarts/crashes as the count will reset. If you save the value, use gettime.
|
Exactly. Plus if you run your server for more than 24h you will occur some problem with gettick.
Re: gettickcount or gettime -
PepsiCola23 - 12.02.2018
so i should be fine with GetTime?
Re: gettickcount or gettime -
AmigaBlizzard - 13.02.2018
If you really need the time to be accurate up to a millisecond, use GetTickCount.
But you can get problems if your server keeps running for more than 2.1 billion milliseconds (= 2.1 million seconds = 35791 minutes = 596 hours = 24 days) because of integer-overflow, the value gets negative and might mess up your entire code.
But in your case, a time of about 6 hours, it won't need that much accuracy so GetTime (which is accurate up to a second) is sufficient.
Re: gettickcount or gettime -
PepsiCola23 - 13.02.2018
ok,i`ll stick to GetTime and store it .
Re: gettickcount or gettime -
Gammix - 13.02.2018
GetTickCount() -> milliseconds
gettime() -> seconds
If you are not dealing in milliseconds, use gettime(). GetTickCount() is usually used for benchmarks.
Edit: Didn't see AmigaBlizzard's reply, but now you have two explanations implying the right method to use!