本文整理汇总了C++中GetTimeInMillis函数的典型用法代码示例。如果您正苦于以下问题:C++ GetTimeInMillis函数的具体用法?C++ GetTimeInMillis怎么用?C++ GetTimeInMillis使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetTimeInMillis函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TimeSinceLastInputEvent
int
TimeSinceLastInputEvent(void)
{
if (lastEventTime == 0)
lastEventTime = GetTimeInMillis();
return GetTimeInMillis() - lastEventTime;
}
示例2: MouseWaitForReadable
static Bool
MouseWaitForReadable (int fd, int timeout)
{
fd_set set;
struct timeval tv, *tp;
int n;
CARD32 done;
done = GetTimeInMillis () + timeout;
for (;;)
{
FD_ZERO (&set);
FD_SET (fd, &set);
if (timeout == -1)
tp = 0;
else
{
tv.tv_sec = timeout / 1000;
tv.tv_usec = (timeout % 1000) * 1000;
tp = &tv;
}
n = select (fd + 1, &set, 0, 0, tp);
if (n > 0)
return TRUE;
if (n < 0 && (errno == EAGAIN || errno == EINTR))
{
timeout = (int) (done - GetTimeInMillis ());
if (timeout > 0)
continue;
}
break;
}
return FALSE;
}
示例3: recv_alive_msg
static void
recv_alive_msg (unsigned length)
{
CARD8 SessionRunning;
CARD32 AliveSessionID;
if (state != XDM_AWAIT_ALIVE_RESPONSE)
return;
if (length != 5)
return;
if (XdmcpReadCARD8 (&buffer, &SessionRunning) &&
XdmcpReadCARD32 (&buffer, &AliveSessionID))
{
if (SessionRunning && AliveSessionID == SessionID)
{
/* backoff dormancy period */
state = XDM_RUN_SESSION;
if ((GetTimeInMillis() - lastDeviceEventTime.milliseconds) >
keepaliveDormancy * 1000)
{
keepaliveDormancy <<= 1;
if (keepaliveDormancy > XDM_MAX_DORMANCY)
keepaliveDormancy = XDM_MAX_DORMANCY;
}
timeOutTime = GetTimeInMillis() + keepaliveDormancy * 1000;
}
else
{
XdmcpDeadSession ("Alive respose indicates session dead");
}
}
}
示例4: MouseFlush
static int
MouseFlush (Kbufio *b, char *buf, int size)
{
CARD32 now = GetTimeInMillis ();
CARD32 done = now + 100;
int c;
int n = 0;
while ((c = MouseReadByte (b, done - now)) != -1)
{
if (buf)
{
if (n == size)
{
memmove (buf, buf + 1, size - 1);
n--;
}
buf[n++] = c;
}
now = GetTimeInMillis ();
if ((INT32) (now - done) >= 0)
break;
}
return n;
}
示例5: TimeSinceLastInputEvent
/*
* TimeSinceLastInputEvent --
* Function used for screensaver purposes by the os module. Returns the
* time in milliseconds since there last was any input.
*/
int
TimeSinceLastInputEvent(void)
{
if (xf86Info.lastEventTime == 0) {
xf86Info.lastEventTime = GetTimeInMillis();
}
return GetTimeInMillis() - xf86Info.lastEventTime;
}
示例6: AccessXKeyboardEvent
static void
AccessXKeyboardEvent(DeviceIntPtr keybd,
BYTE type,
BYTE keyCode,
Bool isRepeat)
{
xEvent xE;
xE.u.u.type = type;
xE.u.u.detail = keyCode;
xE.u.keyButtonPointer.time = GetTimeInMillis();
#ifdef DEBUG
if (xkbDebugFlags&0x8) {
ErrorF("AXKE: Key %d %s\n",keyCode,(xE.u.u.type==KeyPress?"down":"up"));
}
#endif
if (_XkbIsPressEvent(type))
XkbDDXKeyClick(keybd,keyCode,TRUE);
else if (isRepeat)
XkbLastRepeatEvent= (pointer)&xE;
XkbProcessKeyboardEvent(&xE,keybd,1L);
XkbLastRepeatEvent= NULL;
return;
} /* AccessXKeyboardEvent */
示例7: rfbSetXCutText
void
rfbSetXCutText(char *str, int len)
{
int i = 0;
inSetXCutText = TRUE;
ChangeWindowProperty(WindowTable[0], XA_CUT_BUFFER0, XA_STRING,
8, PropModeReplace, len,
(pointer)str, TRUE);
while ((i < NumCurrentSelections) &&
CurrentSelections[i].selection != XA_PRIMARY)
i++;
if (i < NumCurrentSelections) {
xEvent event;
if (CurrentSelections[i].client) {
event.u.u.type = SelectionClear;
event.u.selectionClear.time = GetTimeInMillis();
event.u.selectionClear.window = CurrentSelections[i].window;
event.u.selectionClear.atom = CurrentSelections[i].selection;
(void) TryClientEvents (CurrentSelections[i].client, &event, 1,
NoEventMask, NoEventMask /* CantBeFiltered */,
NullGrab);
}
CurrentSelections[i].window = None;
CurrentSelections[i].pWin = NULL;
CurrentSelections[i].client = NullClient;
}
inSetXCutText = FALSE;
}
示例8: SendKeepAliveEvent
void
SendKeepAliveEvent(ClientPtr client)
{
fsKeepAliveEvent ev;
ev.type = FS_Event;
ev.event_code = KeepAlive;
ev.sequenceNumber = client->sequence;
ev.length = SIZEOF(fsKeepAliveEvent) >> 2;
ev.timestamp = GetTimeInMillis();
#ifdef DEBUG
fprintf(stderr, "client #%d is getting a KeepAlive\n", client->index);
#endif
if (client->swapped) {
/* SErrorEvent requires two fsError pointers */
fsError evTo;
SErrorEvent((fsError *) & ev, (fsError *) &evTo);
(void) WriteToClient(client, SIZEOF(fsKeepAliveEvent), (char *) &evTo);
} else {
(void) WriteToClient(client, SIZEOF(fsKeepAliveEvent), (char *) &ev);
}
}
示例9: TimerCheck
void TimerCheck(void)
{
unsigned int now = GetTimeInMillis();
while (timers && (int)(timers->expires - now) <= 0)
DoTimer(timers, now, &timers);
}
示例10: AnimCurDisplayCursor
static Bool
AnimCurDisplayCursor (ScreenPtr pScreen,
CursorPtr pCursor)
{
AnimCurScreenPtr as = GetAnimCurScreen(pScreen);
Bool ret;
Unwrap (as, pScreen, DisplayCursor);
if (IsAnimCur(pCursor))
{
if (pCursor != animCurState.pCursor)
{
AnimCurPtr ac = GetAnimCur(pCursor);
ret = (*pScreen->DisplayCursor) (pScreen, ac->elts[0].pCursor);
if (ret)
{
animCurState.elt = 0;
animCurState.time = GetTimeInMillis () + ac->elts[0].delay;
animCurState.pCursor = pCursor;
animCurState.pScreen = pScreen;
}
}
else
ret = TRUE;
}
else
{
animCurState.pCursor = 0;
animCurState.pScreen = 0;
ret = (*pScreen->DisplayCursor) (pScreen, pCursor);
}
Wrap (as, pScreen, DisplayCursor, AnimCurDisplayCursor);
return ret;
}
示例11: send_packet
static void
send_packet(void)
{
int rtx;
switch (state) {
case XDM_QUERY:
case XDM_BROADCAST:
case XDM_INDIRECT:
#if defined(IPv6) && defined(AF_INET6)
case XDM_MULTICAST:
#endif
send_query_msg();
break;
case XDM_START_CONNECTION:
send_request_msg();
break;
case XDM_MANAGE:
send_manage_msg();
break;
case XDM_KEEPALIVE:
send_keepalive_msg();
break;
default:
break;
}
rtx = (XDM_MIN_RTX << timeOutRtx);
if (rtx > XDM_MAX_RTX)
rtx = XDM_MAX_RTX;
timeOutTime = GetTimeInMillis() + rtx * 1000;
}
示例12: wcmFingerTapToClick
static void wcmFingerTapToClick(WacomDevicePtr priv)
{
WacomCommonPtr common = priv->common;
WacomChannelPtr firstChannel = common->wcmChannel;
WacomChannelPtr secondChannel = common->wcmChannel + 1;
WacomDeviceState ds[2] = { firstChannel->valid.states[0],
secondChannel->valid.states[0] };
WacomDeviceState dsLast[2] = { firstChannel->valid.states[1],
secondChannel->valid.states[1] };
DBG(10, priv, "\n");
/* process second finger tap if matched */
if ((ds[0].sample < ds[1].sample) &&
((GetTimeInMillis() -
dsLast[1].sample) <= common->wcmGestureParameters.wcmTapTime) &&
!ds[1].proximity && dsLast[1].proximity)
{
/* send left up before sending right down */
wcmSendButtonClick(priv, 1, 0);
common->wcmGestureMode = GESTURE_TAP_MODE;
/* right button down */
wcmSendButtonClick(priv, 3, 1);
/* right button up */
wcmSendButtonClick(priv, 3, 0);
}
}
示例13: do_butmap_change
static void
do_butmap_change(DeviceIntPtr dev, CARD8 *map, int len, ClientPtr client)
{
int i;
xEvent core_mn;
deviceMappingNotify xi_mn;
/* The map in ButtonClassRec refers to button numbers, whereas the
* protocol is zero-indexed. Sigh. */
memcpy(&(dev->button->map[1]), map, len);
core_mn.u.u.type = MappingNotify;
core_mn.u.mappingNotify.request = MappingPointer;
/* 0 is the server client. */
for (i = 1; i < currentMaxClients; i++) {
/* Don't send irrelevant events to naïve clients. */
if (!clients[i] || clients[i]->clientState != ClientStateRunning)
continue;
if (!XIShouldNotify(clients[i], dev))
continue;
core_mn.u.u.sequenceNumber = clients[i]->sequence;
WriteEventsToClient(clients[i], 1, &core_mn);
}
xi_mn.type = DeviceMappingNotify;
xi_mn.request = MappingPointer;
xi_mn.deviceid = dev->id;
xi_mn.time = GetTimeInMillis();
SendEventToAllWindows(dev, DeviceMappingNotifyMask, (xEvent *) &xi_mn, 1);
}
示例14: AnimCurScreenBlockHandler
static void
AnimCurScreenBlockHandler (int screenNum,
pointer blockData,
pointer pTimeout,
pointer pReadmask)
{
ScreenPtr pScreen = screenInfo.screens[screenNum];
AnimCurScreenPtr as = GetAnimCurScreen(pScreen);
DeviceIntPtr dev;
Bool activeDevice = FALSE;
CARD32 now = 0,
soonest = ~0; /* earliest time to wakeup again */
for (dev = inputInfo.devices; dev; dev = dev->next)
{
if (IsPointerDevice(dev) && pScreen == dev->spriteInfo->anim.pScreen)
{
if (!activeDevice) {
now = GetTimeInMillis ();
activeDevice = TRUE;
}
if ((INT32) (now - dev->spriteInfo->anim.time) >= 0)
{
AnimCurPtr ac = GetAnimCur(dev->spriteInfo->anim.pCursor);
int elt = (dev->spriteInfo->anim.elt + 1) % ac->nelt;
DisplayCursorProcPtr DisplayCursor;
/*
* Not a simple Unwrap/Wrap as this
* isn't called along the DisplayCursor
* wrapper chain.
*/
DisplayCursor = pScreen->DisplayCursor;
pScreen->DisplayCursor = as->DisplayCursor;
(void) (*pScreen->DisplayCursor) (dev,
pScreen,
ac->elts[elt].pCursor);
as->DisplayCursor = pScreen->DisplayCursor;
pScreen->DisplayCursor = DisplayCursor;
dev->spriteInfo->anim.elt = elt;
dev->spriteInfo->anim.time = now + ac->elts[elt].delay;
}
if (soonest > dev->spriteInfo->anim.time)
soonest = dev->spriteInfo->anim.time;
}
}
if (activeDevice)
AdjustWaitForDelay (pTimeout, soonest - now);
Unwrap (as, pScreen, BlockHandler);
(*pScreen->BlockHandler) (screenNum, blockData, pTimeout, pReadmask);
if (activeDevice)
Wrap (as, pScreen, BlockHandler, AnimCurScreenBlockHandler);
else
as->BlockHandler = NULL;
}
示例15: SertafiedBlockHandler
static void
SertafiedBlockHandler(void *data, void *wt)
{
SertafiedPtr pReq, pNext;
unsigned long delay;
TimeStamp now;
if (!pPending)
return;
now.milliseconds = GetTimeInMillis();
now.months = currentTime.months;
if ((int) (now.milliseconds - currentTime.milliseconds) < 0)
now.months++;
for (pReq = pPending; pReq; pReq = pNext) {
pNext = pReq->next;
if (CompareTimeStamps(pReq->revive, now) == LATER)
break;
FreeResource(pReq->id, RT_NONE);
/* AttendClient() may have been called via the resource delete
* function so a client may have input to be processed and so
* set delay to 0 to prevent blocking in WaitForSomething().
*/
AdjustWaitForDelay(wt, 0);
}
pReq = pPending;
if (!pReq)
return;
delay = pReq->revive.milliseconds - now.milliseconds;
AdjustWaitForDelay(wt, delay);
}