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


C++ OsTime::cvtToMsecs方法代码示例

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


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

示例1: testAcceptTimeout

 /**
  * Test accept with various timeouts
  */
 void testAcceptTimeout()
 {
 	OsTime before;
 	OsTime after;
 	
     OsServerSocket* server = new OsServerSocket(50, 8021);
     
     OsDateTime::getCurTime(before);
     OsSocket* serverClient = server->accept(50);
     OsTask::delay(16) ; // Wait a bit to deal for poor time resolution
     OsDateTime::getCurTime(after);
     CPPUNIT_ASSERT_MESSAGE("socket server accept returned unexpected data", 
                            serverClient == NULL);
     CPPUNIT_ASSERT_MESSAGE("socket server accept returned before timeout", 
     					   (after.cvtToMsecs() - before.cvtToMsecs()) >= 50);
                    
     OsDateTime::getCurTime(before);
     serverClient = server->accept(500);
     OsTask::delay(16) ; // Wait a bit to deal for poor time resolution        
     OsDateTime::getCurTime(after);
     CPPUNIT_ASSERT_MESSAGE("socket server accept returned unexpected data", 
                            serverClient == NULL);
     CPPUNIT_ASSERT_MESSAGE("socket server accept returned before timeout", 
     					   (after.cvtToMsecs() - before.cvtToMsecs()) >= 500);        
     server->close();
     delete server;
 }	
开发者ID:mranga,项目名称:sipxecs,代码行数:30,代码来源:OsSocketTest.cpp

示例2: srand

// Constructor
UtlRandom::UtlRandom()
{
    static int siCounter = 0 ;

    int iTaskId = 0 ;
    OsTime now ;
    unsigned int seed ;

    OsTask::getCurrentTaskId(iTaskId) ;      
    OsDateTime::getCurTime(now) ;

    seed = (now.cvtToMsecs() ^ (now.usecs() + (now.usecs() << 16)) ^ 
            iTaskId) + siCounter++ ;

    srand(seed) ;
}
开发者ID:Jaroslav23,项目名称:sipxtapi,代码行数:17,代码来源:UtlRandom.cpp

示例3: doReceive

// Helper function for removing a message from the head of the queue
OsStatus OsMsgQShared::doReceive(OsMsg*& rpMsg, const OsTime& rTimeout)
{
  OsStatus ret;

  if (!rTimeout.isInfinite())
  {
    int expireFromNow = rTimeout.cvtToMsecs();
    if (try_dequeue(rpMsg, expireFromNow))
      ret = OS_SUCCESS;
    else
      ret = OS_WAIT_TIMEOUT;
  }
  else
  {
    dequeue(rpMsg);
    ret = OS_SUCCESS;
  }

   system_tap_queue_dequeue(mName.data(), 0, _queue.size());

   return ret;
}
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:23,代码来源:OsMsgQShared.cpp

示例4: OSBtelTransferBridge

/**
 * Bridging Transfer.
 *
 */
static
VXItelResult OSBtelTransferBridge(VXItelInterface * vxip, 
      const VXIMap * prop,
      const VXIchar * transferDestination,
      const VXIMap * data,
      VXIMap **resp)
{
   OSBtelImpl *impl = ToOSBtelImpl(vxip);
   Diag(impl, DIAG_TAG_SIGNALING, NULL, L"TransferBridge: %s", 
         transferDestination);

   *resp = VXIMapCreate();

   VXIchar* dest = 0;
   VXIchar* xaudio = 0;
   if (prop != NULL) {
      VXIString* vect =(VXIString*)VXIMapGetProperty(prop, L"Destination");
      if (vect != NULL) 
         dest = (VXIchar*) VXIStringCStr(vect);

      vect =(VXIString*)VXIMapGetProperty(prop, TEL_TRANSFER_AUDIO);
      if (vect != NULL) 
         xaudio = (VXIchar*) VXIStringCStr(vect);
   }

   *resp = VXIMapCreate();
   if (impl->callId && transferDestination)
   {
      vxistring dest = transferDestination;
      if (! dest.empty()) 
      {
         char* str = 0;
         int len = dest.length() + 1;
         if (len > 0)
         {
            str = new char [len + 1];
            wcstombs(str, transferDestination, len);
            str[len] = 0;
         }

         if (str)
         {
            UtlString from(str);
            HttpMessage::unescape( from );

            if (impl->live == 1)
            {
                impl->pCallMgr->connect((char*)impl->callId, from.data()); 

                impl->transferred = 0;
                int state = 0;
                int status = VXItel_TRANSFER_UNKNOWN;
                int duration = 0;
                OsTime   startTime;
                OsTime   endTime;
                OsDateTimeBase::getCurTime(startTime);

                VXItelResult ret;
                do 
                {
                        ret = setTransferState(impl, prop, transferDestination, resp, &state, &status);
                }
                while (state != PtEvent::CONNECTION_DISCONNECTED &&
                          state != PtEvent::CONNECTION_FAILED &&
                          ret != VXItel_RESULT_TIMEOUT);

                OsDateTimeBase::getCurTime(endTime);
                duration = (endTime.cvtToMsecs() - startTime.cvtToMsecs())/1000;
                VXIMapSetProperty(*resp, TEL_TRANSFER_STATUS, (VXIValue *) VXIIntegerCreate(status));
                VXIMapSetProperty(*resp, TEL_TRANSFER_DURATION, (VXIValue *)VXIIntegerCreate(duration));
            }
            else
            {
                Diag(impl, DIAG_TAG_SIGNALING, NULL, L"Exiting called, live=%d, cancel TransferBridge: %s",
                        impl->live, transferDestination);
            }
         }
      }
   }

   return VXItel_RESULT_SUCCESS;
}
开发者ID:mranga,项目名称:sipxecs,代码行数:86,代码来源:osbtel.cpp

示例5: OSBtelTransferBlind

/**
 * Blind Transfer.
 */
static
VXItelResult OSBtelTransferBlind(VXItelInterface * vxip, 
      const VXIMap * prop,
      const VXIchar * transferDestination,
      const VXIMap * data,
      VXIMap ** resp)
{
   OSBtelImpl *impl = ToOSBtelImpl(vxip);
   Diag(impl, DIAG_TAG_SIGNALING, NULL, L"TransferBlind: %s", 
         transferDestination);

   VXIchar* best = (VXIchar *) calloc(128, sizeof(VXIchar));
   if (prop != NULL) {
      VXIString* vect =(VXIString*)VXIMapGetProperty(prop, L"Destination");
      if (vect != NULL) best = (VXIchar*) VXIStringCStr(vect);
   }

   *resp = VXIMapCreate();
   if (impl->callId && transferDestination)
   {
      vxistring dest = transferDestination;
      if (! dest.empty()) 
      {
         char* str = 0;
         int len = dest.length() + 1;
         if (len > 0)
         {
            str = new char [len + 1];
            wcstombs(str, transferDestination, len);
            str[len] = 0;
         }

         if (str)
         {
            UtlString from(str);
            HttpMessage::unescape( from );
            OsSysLog::add(FAC_MEDIASERVER_VXI, PRI_DEBUG, "OSBtelTransferBlind from = '%s'", from.data());
            if (impl->live == 1) 
            {
                if (PT_SUCCESS == impl->pCallMgr->transfer_blind((char*)impl->callId,
                                                                 from.data(), // to url
                                                                 0, // target call id
                                                                 0, // target connect addr
                                                                 false // no remote hold first
                                                                 )
                    )
                {
                        impl->transferred = 0;
                        int state = 0;
                        int status = VXItel_TRANSFER_UNKNOWN;
                        int duration = 0;
                        OsTime   startTime;
                        OsTime   endTime;
                        OsDateTimeBase::getCurTime(startTime);

                        setTransferState(impl, prop, transferDestination, resp, &state, &status);

                        OsDateTimeBase::getCurTime(endTime);
                        duration = (endTime.cvtToMsecs() - startTime.cvtToMsecs())/1000;
                        VXIMapSetProperty(*resp, TEL_TRANSFER_STATUS, (VXIValue *) VXIIntegerCreate(status));
                        VXIMapSetProperty(*resp, TEL_TRANSFER_DURATION, (VXIValue *)VXIIntegerCreate(duration));
                }
            }
            else
            {
                Diag(impl, DIAG_TAG_SIGNALING, NULL, L"Exiting called, live=%d, cancel TransferBlind: %s", 
                        impl->live, transferDestination);
            }
         }
      }
   }

   return VXItel_RESULT_SUCCESS;
}
开发者ID:mranga,项目名称:sipxecs,代码行数:77,代码来源:osbtel.cpp

示例6: srand

// Constructor
UtlRandom::UtlRandom()
{
    OsTime now ;
    OsDateTime::getCurTime(now) ;
    srand((int) (now.cvtToMsecs() % INT_MAX)) ;
}
开发者ID:Konnekt,项目名称:lib-sipx,代码行数:7,代码来源:UtlRandom.cpp


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