当前位置: 首页>>代码示例>>C++>>正文


C++ IntervalTimer::Reset方法代码示例

本文整理汇总了C++中IntervalTimer::Reset方法的典型用法代码示例。如果您正苦于以下问题:C++ IntervalTimer::Reset方法的具体用法?C++ IntervalTimer::Reset怎么用?C++ IntervalTimer::Reset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IntervalTimer的用法示例。


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

示例1: OnUpdate

 void OnUpdate(uint32 diff) {
     m_rewardTimer.Update(diff);
     if(m_rewardTimer.Passed())
     {
         m_rewardTimer.Reset();
         sendRewards();
     }
 }
开发者ID:Nedj,项目名称:CG-Blizzlike,代码行数:8,代码来源:donations.cpp

示例2: OnConfigLoad

    void OnConfigLoad(bool /*reload*/)
    {
        ExternalMail            = ConfigMgr::GetBoolDefault("ExternalMail", false);

        if (!ExternalMail)
            return;

        ExternalMailInterval    = ConfigMgr::GetIntDefault("ExternalMailInterval", 1);

        extmail_timer.SetInterval(ExternalMailInterval * MINUTE * IN_MILLISECONDS);
        extmail_timer.Reset();
    }
开发者ID:lemex,项目名称:TrinityNya,代码行数:12,代码来源:mod_ExternalMail.cpp

示例3: OnUpdate

    void OnUpdate(uint32 diff)
    {
        if (!ExternalMail)
            return;

        if (extmail_timer.GetCurrent() >= 0)
            extmail_timer.Update(diff);
        else
            extmail_timer.SetCurrent(0);

        if (extmail_timer.Passed())
        {
            extmail_timer.Reset();
            SendExternalMails();
        }
    }
开发者ID:lemex,项目名称:TrinityNya,代码行数:16,代码来源:mod_ExternalMail.cpp

示例4: main


//.........这里部分代码省略.........

        bool Prio = sConfig.GetBoolDefault("ProcessPriority", false);

        if(Prio)
        {
            if(SetPriorityClass(hProcess,HIGH_PRIORITY_CLASS))
                sLog.outString("realmd process priority class set to HIGH");
            else
                sLog.outError("Can't set realmd process priority class.");
            sLog.outString();
        }
    }
    #endif

    //server has started up successfully => enable async DB requests
    LoginDatabase.AllowAsyncTransactions();

    // maximum counter for next ping
    uint32 numLoops = (sConfig.GetIntDefault( "MaxPingTime", 30 ) * (MINUTE * 1000000 / 100000));
    uint32 loopCounter = 0;

    uint32 last_ping_time = 0;
    uint32 now = WorldTimer::getMSTime();
    uint32 diff;
    uint32 lasttime = now;
    uint32 last_ipprops_cleanup = 0;

    ///- Wait for termination signal
    while (!stopEvent)
    {
        // dont move this outside the loop, the reactor will modify it
        ACE_Time_Value interval(0, 100000);

        if (ACE_Reactor::instance()->run_reactor_event_loop(interval) == -1)
            break;

        now = WorldTimer::getMSTime();
        diff = WorldTimer::getMSTimeDiff(lasttime, now);
        lasttime = now;

        badPointsTimer.Update(diff);

        if( (++loopCounter) == numLoops )
        {
            // FG: protect against network system overloading
            // if that happens, force realmd close (autorestarter ftw!)
            
            if(WorldTimer::getMSTimeDiff(last_ping_time, now) < 10000)
            {
                sLog.outError("NETWORK SYSTEM OVERLOAD");
                raise(SIGSEGV); // force close
                abort();
            }

            last_ping_time = now;
            loopCounter = 0;
            DETAIL_LOG("Ping MySQL to keep connection alive");
            LoginDatabase.Ping();
        }

        // FG: clear flood protect buffer periodically
        if(WorldTimer::getMSTimeDiff(last_ipprops_cleanup, now) > 30000) // flush stored IPs every 30 secs
        {
            last_ipprops_cleanup = now;
            uint32 flushed = 0, blocked = 0, stored = 0;
            CleanupIPPropmap(flushed, blocked, stored);
            sLog.outDetail("IPProp: Flushed %u total, %u of them blocked, now %u stored", flushed, blocked, stored);
        }

        // FG: handle "bad points" drop
        if(badPointsTimer.Passed())
        {
            badPointsTimer.Reset();
            if(badPointsDropAmount)
            {
                uint64 goodtime = uint64(time(NULL)) - badPointsDropWaitTime;
                LoginDatabase.Execute("UPDATE account_badpoints SET maxpts = curpts WHERE maxpts < curpts");
                LoginDatabase.PExecute("UPDATE account_badpoints SET curpts = 0 WHERE curpts <= %u AND lasttime < "UI64FMTD,
                    badPointsDropAmount, goodtime);
                LoginDatabase.PExecute("UPDATE account_badpoints SET curpts = curpts - %u WHERE curpts > %u AND lasttime < "UI64FMTD,
                    badPointsDropAmount, badPointsDropAmount, goodtime);
            }
        }


#ifdef WIN32
        if (m_ServiceStatus == 0) stopEvent = true;
        while (m_ServiceStatus == 2) Sleep(1000);
#endif
    }

    ///- Wait for the delay thread to exit
    LoginDatabase.HaltDelayThread();

    ///- Remove signal handling before leaving
    UnhookSignals();

    sLog.outString( "Halting process..." );
    return 0;
}
开发者ID:Wisznu,项目名称:mangos,代码行数:101,代码来源:Main.cpp


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