• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ GetTimeInMillis函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中GetTimeInMillis函数的典型用法代码示例。如果您正苦于以下问题:C++ GetTimeInMillis函数的具体用法?C++ GetTimeInMillis怎么用?C++ GetTimeInMillis使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了GetTimeInMillis函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: TimeSinceLastInputEvent

int
TimeSinceLastInputEvent(void)
{
    if (lastEventTime == 0)
        lastEventTime = GetTimeInMillis();
    return GetTimeInMillis() - lastEventTime;
}
开发者ID:Agnesa,项目名称:xserver,代码行数:7,代码来源:Events.c


示例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;
}
开发者ID:L3oV1nc3,项目名称:VMGL,代码行数:34,代码来源:mouse.c


示例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");
    	}
    }
}
开发者ID:marioaugustorama,项目名称:tropix-xwindow,代码行数:32,代码来源:xdmcp.c


示例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;
}
开发者ID:L3oV1nc3,项目名称:VMGL,代码行数:25,代码来源:mouse.c


示例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;
}
开发者ID:4eremuxa,项目名称:xserver,代码行数:13,代码来源:xf86Events.c


示例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 */
开发者ID:GrahamCobb,项目名称:maemo-xsisusb,代码行数:26,代码来源:xkbAccessX.c


示例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;
}
开发者ID:L3oV1nc3,项目名称:VMGL,代码行数:34,代码来源:cutpaste.c


示例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);
    }
}
开发者ID:shanelle794,项目名称:theqvd,代码行数:25,代码来源:events.c


示例9: TimerCheck

void TimerCheck(void)
{
	unsigned int now = GetTimeInMillis();

	while (timers && (int)(timers->expires - now) <= 0)
		DoTimer(timers, now, &timers);
}
开发者ID:tenmachow,项目名称:laser-emu,代码行数:7,代码来源:laser-emu.c


示例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;
}
开发者ID:BackupTheBerlios,项目名称:dri-ex-svn,代码行数:35,代码来源:animcur.c


示例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;
}
开发者ID:halfline,项目名称:xserver,代码行数:31,代码来源:xdmcp.c


示例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);
	}
}
开发者ID:cbagwell,项目名称:xf86-input-wacom,代码行数:29,代码来源:wcmTouchFilter.c


示例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);
}
开发者ID:Happy-Ferret,项目名称:xserver-with-gl-accelerated-xephyr,代码行数:34,代码来源:inpututils.c


示例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;
}
开发者ID:eriytt,项目名称:xserver-xsdl,代码行数:60,代码来源:animcur.c


示例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);
}
开发者ID:XQuartz,项目名称:xorg-server,代码行数:31,代码来源:sleepuntil.c


示例16: wcmFingerTapToClick

static void wcmFingerTapToClick(WacomDevicePtr priv)
{
	WacomCommonPtr common = priv->common;
	WacomDeviceState ds[2] = {}, dsLast[2] = {};

	if (!common->wcmGesture)
		return;

	getStateHistory(common, ds, ARRAY_SIZE(ds), 0);
	getStateHistory(common, dsLast, ARRAY_SIZE(dsLast), 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);
	}
}
开发者ID:jigpu,项目名称:xf86-input-wacom,代码行数:30,代码来源:wcmTouchFilter.c


示例17: XdmcpWakeupHandler

 /*ARGSUSED*/ static void
XdmcpWakeupHandler(void *data,        /* unused */
                   int i, void *pReadmask)
{
    fd_set *last_select_mask = (fd_set *) pReadmask;

    if (state == XDM_OFF)
        return;
    if (i > 0) {
        if (FD_ISSET(xdmcpSocket, last_select_mask)) {
            receive_packet(xdmcpSocket);
            FD_CLR(xdmcpSocket, last_select_mask);
        }
#if defined(IPv6) && defined(AF_INET6)
        if (xdmcpSocket6 >= 0 && FD_ISSET(xdmcpSocket6, last_select_mask)) {
            receive_packet(xdmcpSocket6);
            FD_CLR(xdmcpSocket6, last_select_mask);
        }
#endif
    }
    else if (timeOutTime && (int) (GetTimeInMillis() - timeOutTime) >= 0) {
        if (state == XDM_RUN_SESSION) {
            state = XDM_KEEPALIVE;
            send_packet();
        }
        else
            timeout();
    }
}
开发者ID:halfline,项目名称:xserver,代码行数:29,代码来源:xdmcp.c


示例18: DarwinSendDDXEvent

/*
 * DarwinSendDDXEvent
 *  Send the X server thread a message by placing it on the event queue.
 */
void
DarwinSendDDXEvent(int type, int argc, ...)
{
    XQuartzEvent e;
    int i;
    va_list args;

    memset(&e, 0, sizeof(e));
    e.header = ET_Internal;
    e.type = ET_XQuartz;
    e.length = sizeof(e);
    e.time = GetTimeInMillis();
    e.subtype = type;

    if (argc > 0 && argc < XQUARTZ_EVENT_MAXARGS) {
        va_start(args, argc);
        for (i = 0; i < argc; i++)
            e.data[i] = (uint32_t)va_arg(args, uint32_t);
        va_end(args);
    }

    darwinEvents_lock();
    {
        mieqEnqueue(NULL, (InternalEvent *)&e);
        DarwinPokeEQ();
    }
    darwinEvents_unlock();
}
开发者ID:GalliumOS,项目名称:xorg-server,代码行数:32,代码来源:darwinEvents.c


示例19: XdmcpWakeupHandler

/*ARGSUSED*/
static void
XdmcpWakeupHandler(
    pointer data,   /* unused */
    int	    i,
    pointer pReadmask)
{
    fd_set* LastSelectMask = (fd_set*)pReadmask;
    fd_set   devicesReadable;

    if (state == XDM_OFF)
	return;
    if (i > 0)
    {
	if (FD_ISSET(xdmcpSocket, LastSelectMask))
	{
	    receive_packet(xdmcpSocket);
	    FD_CLR(xdmcpSocket, LastSelectMask);
	} 
#if defined(IPv6) && defined(AF_INET6)
	if (xdmcpSocket6 >= 0 && FD_ISSET(xdmcpSocket6, LastSelectMask))
	{
	    receive_packet(xdmcpSocket6);
	    FD_CLR(xdmcpSocket6, LastSelectMask);
	} 
#endif
	XFD_ANDSET(&devicesReadable, LastSelectMask, &EnabledDevices);
	if (XFD_ANYSET(&devicesReadable))
	{
	    if (state == XDM_AWAIT_USER_INPUT)
		restart();
	    else if (state == XDM_RUN_SESSION)
		keepaliveDormancy = defaultKeepaliveDormancy;
	}
	if (XFD_ANYSET(&AllClients) && state == XDM_RUN_SESSION)
	    timeOutTime = GetTimeInMillis() +  keepaliveDormancy * 1000;
    }
    else if (timeOutTime && (int) (GetTimeInMillis() - timeOutTime) >= 0)
    {
    	if (state == XDM_RUN_SESSION)
    	{
	    state = XDM_KEEPALIVE;
	    send_packet();
    	}
    	else
	    timeout();
    }
}
开发者ID:marioaugustorama,项目名称:tropix-xwindow,代码行数:48,代码来源:xdmcp.c


示例20: XkbSendStateNotify

void
XkbSendStateNotify(DeviceIntPtr kbd,xkbStateNotify *pSN)
{
XkbSrvInfoPtr	xkbi;
XkbStatePtr	state;
XkbInterestPtr	interest;
Time 		time;
register CARD16	changed,bState;

    interest = kbd->xkb_interest;
    if (!interest)
	return;
    xkbi = kbd->key->xkbInfo;
    state= &xkbi->state;

    pSN->type = XkbEventCode + XkbEventBase;
    pSN->xkbType = XkbStateNotify;
    pSN->deviceID = kbd->id;
    pSN->time = time = GetTimeInMillis();
    pSN->mods = state->mods;
    pSN->baseMods = state->base_mods;
    pSN->latchedMods = state->latched_mods;
    pSN->lockedMods = state->locked_mods;
    pSN->group = state->group;
    pSN->baseGroup = state->base_group;
    pSN->latchedGroup = state->latched_group;
    pSN->lockedGroup = state->locked_group;
    pSN->compatState = state->compat_state;
    pSN->grabMods = state->grab_mods;
    pSN->compatGrabMods = state->compat_grab_mods;
    pSN->lookupMods = state->lookup_mods;
    pSN->compatLookupMods = state->compat_lookup_mods;
    pSN->ptrBtnState = state->ptr_buttons;
    changed = pSN->changed;
    bState= pSN->ptrBtnState;

    while (interest) {
	if ((!interest->client->clientGone) &&
	    (interest->client->requestVector != InitialVector) &&
	    (interest->client->xkbClientFlags&_XkbClientInitialized) &&
	    (interest->stateNotifyMask&changed)) {
	    pSN->sequenceNumber = interest->client->sequence;
	    pSN->time = time;
	    pSN->changed = changed;
	    pSN->ptrBtnState = bState;
	    if ( interest->client->swapped ) {
		register int n;
		swaps(&pSN->sequenceNumber,n);
		swapl(&pSN->time,n);
		swaps(&pSN->changed,n);
		swaps(&pSN->ptrBtnState,n);
	    }
	    WriteToClient(interest->client, sizeof(xEvent), (char *)pSN);
	}
	interest= interest->next;
    }
    return;
}
开发者ID:aosm,项目名称:X11,代码行数:58,代码来源:xkbEvents.c



注:本文中的GetTimeInMillis函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GetTimeMs函数代码示例发布时间:2022-05-30
下一篇:
C++ GetTimeFormat函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap