gettickcount or gettime
#1

as the title says,which one`s better to use for a command that can be used every 6 hours?
Reply
#2

gettickcount of course.
Reply
#3

Quote:
Originally Posted by Mugala
Посмотреть сообщение
gettickcount of course.
Why?
Reply
#4

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
Reply
#5

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.
Reply
#6

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.
Reply
#7

so i should be fine with GetTime?
Reply
#8

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.
Reply
#9

ok,i`ll stick to GetTime and store it .
Reply
#10

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!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)