milliseconds for gettime
#1

Is it possible to put milliseconds for this
pawn Код:
gettime() + (*Here);
Reply
#2

One second is equal to 1000ms, so... some division/subtraction operators should do you fine, right?
Reply
#3

I don't understand what you're asking.
Reply
#4

Use GetTickCount? If you're asking how to convert gettime in to milliseconds it's not possible.
Reply
#5

Well for gettime, it's seconds. I want to put it to milliseconds.
Reply
#6

gettime() return unix timestamp, which increase every second. So its not possible to calculate ms with gettime(), you can use GetTickCount for that.
Reply
#7

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

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

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)