⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 siptimer.h

📁 一个SIP协议栈
💻 H
字号:
#ifndef __SIPTIMER_H__#define __SIPTIMER_H__/********************************************************************* $Id: SIPTimer.h,v 1.2 1999/08/31 02:22:05 cullen Exp $ *********************************************************************  This library is free software; you can redistribute it and/or modify  it under the terms of the GNU Lesser General Public License as  published by the Free Software Foundation; either version 2 of the  License, or (at your option) any later version.  In addition to the  terms and conditions set forth in the GNU Lesser General Public  License, as a condition of using this library you are required to  grant to all users of this library or any implementation utilizing  or derived from this library a reciprocal, no cost, worldwide,  perpetual, non-exclusive, non-transferable, unrestricted license to  your claims of all patents and patent applications throughout the  world that are infringed by the library or any implementation  utilizing or derived from this library.  In the event you  redistribute this library or any implementation utilizing or derived  from this library, you must prominently display the foregoing terms  and conditions with the library or the implementation utilizing or  derived from this library.   In the event of a conflict of terms between the foregoing license  grant and the terms set forth in the GNU Lesser General Public  License, the foregoing terms and conditions shall be deemed to  govern.   This library is distributed in the hope that it will be useful, but  WITHOUT ANY WARRANTY; without even the implied warranty of  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU  Lesser General Public License for more details.   You should have received a copy of the GNU Lesser General Public  License along with this library; if not; write to the Free Software  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA.   Copyright 1999 Vovida Networks, Inc.  All Rights Reserved. ********************************************************************* $Log: SIPTimer.h,v $ Revision 1.2  1999/08/31 02:22:05  cullen updated header **********************************************************************/#include <sys/time.h>namespace msip{    //==================================================================================    ///Timer Set and Check Interval (milliseconds)    class Timer    {        ///Current interval in milliseconds        long    tm_Interval;        ///Time value        timeval tm_Time;    public:        ///Default constructor        Timer() : tm_Interval(0) { tm_Time.tv_sec = 0; tm_Time.tv_usec = 0; }        ///Whether all values are empty        bool empty() { return tm_Time.tv_sec == 0 && tm_Time.tv_usec == 0 && tm_Interval == 0; }        ///Set tm_Time as the Current time-stamp        void setCurrent();        ///Set time interval         void setInterval(long milli_sec);        ///Get current interval (milliseconds) from the last setCurrent        long getInterval() const;        ///Get interval between two timers in milliseconds        long getInterval(const Timer &tm) const;        ///Check if current time value is out of current interval        bool outOfInterval() const;        ///Check if the Timer 'tm' is out of current interval        bool outOfInterval(const Timer &tm) const;    };}#endif    

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -