Posts: 728
Threads: 109
Joined: May 2015
Reputation:
0
as the title says,which one`s better to use for a command that can be used every 6 hours?
Posts: 728
Threads: 109
Joined: May 2015
Reputation:
0
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
Posts: 3,133
Threads: 71
Joined: Dec 2013
Reputation:
0
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.
Posts: 728
Threads: 109
Joined: May 2015
Reputation:
0
so i should be fine with GetTime?
Posts: 319
Threads: 7
Joined: Jul 2012
Reputation:
0
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.
Posts: 728
Threads: 109
Joined: May 2015
Reputation:
0
ok,i`ll stick to GetTime and store it .
Posts: 1,773
Threads: 47
Joined: Jan 2015
Reputation:
0
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!