milliseconds for gettime -
Tanush123 - 07.06.2013
Is it possible to put milliseconds for this
Re: milliseconds for gettime -
Scenario - 07.06.2013
One second is equal to 1000ms, so... some division/subtraction operators should do you fine, right?
Re: milliseconds for gettime -
eblood1 - 07.06.2013
I don't understand what you're asking.
Re: milliseconds for gettime -
MP2 - 07.06.2013
Use GetTickCount? If you're asking how to convert gettime in to milliseconds it's not possible.
Re: milliseconds for gettime -
Tanush123 - 07.06.2013
Well for gettime, it's seconds. I want to put it to milliseconds.
Re: milliseconds for gettime -
Richie© - 07.06.2013
gettime() return unix timestamp, which increase every second. So its not possible to calculate ms with gettime(), you can use
GetTickCount for that.
Re: milliseconds for gettime -
Mauzen - 07.06.2013
Either do seconds*1000 if you just need the ms value. Or tickcount()%1000 if you just need some millisecond value. Or use some surprisingly ugly code to synchronize tickcount with the system time.
Something like this
pawn Код:
#define GetTimeMS() ((GetTickCount() % 1000)-global_syncvalue)
new global_synctimer;
new global_syncvalue;
//In OnGamemodeInit:
new h,m;
gettime(h, m, global_syncvalue);
global_synctimer = SetTimer("TickSync", 10, 1);
//Somewhere
forward TickSync();
public TickSync() {
new h,m,s;
gettime(h, m, s);
// Approximates the millisecond time when GetTime goes up a second
if (s != global_syncvalue) {
global_syncvalue = GetTickCount()%1000-100;
KillTimer(global_synctimer);
}
}
GetTimeMS() then gives you the approximated current system time millisecond component.
Re: milliseconds for gettime -
Tanush123 - 07.06.2013
I don't want to create another timer. It's just a question, i only use 1 timer with timestamp
. But the question is answer, it's not possible.
Re: milliseconds for gettime -
MP2 - 12.06.2013
Quote:
Originally Posted by Tanush123
Well for gettime, it's seconds. I want to put it to milliseconds.
|
Why? You want it so if they connect 50 milliseconds before their unban time they're still banned? That's one of the stupidest things I've EVER heard.
Re: milliseconds for gettime -
Tanush123 - 13.06.2013
Quote:
Originally Posted by MP2
Why? You want it so if they connect 50 milliseconds before their unban time they're still banned? That's one of the stupidest things I've EVER heard.
|
I want to put anti spam for half a second.