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

C++ setTime函数代码示例

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

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



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

示例1: setTime

void Aquaduino::initNetwork() {
	int8_t status = 0;

	m_MAC[0] = 0xDE;
	m_MAC[1] = 0xAD;
	m_MAC[2] = 0xBE;
	m_MAC[3] = 0xEF;
	m_MAC[4] = 0xDE;
	m_MAC[5] = 0xAD;

	if (m_DHCP) {
		Serial.println(F("Waiting for DHCP reply..."));
		status = Ethernet.begin(m_MAC);
	}
	if (!m_DHCP || !status) {
		Serial.println(F("Using static network configuration..."));
		Ethernet.begin(m_MAC, m_IP, m_DNSServer, m_Gateway, m_Netmask);
	}

	m_IP = Ethernet.localIP();
	m_DNSServer = Ethernet.dnsServerIP();
	m_Gateway = Ethernet.gatewayIP();
	m_Netmask = Ethernet.subnetMask();

	Serial.print(F("IP: "));
	Serial.println(m_IP);
	Serial.print(F("Netmask: "));
	Serial.println(m_Netmask);
	Serial.print(F("Gateway: "));
	Serial.println(m_Gateway);
	Serial.print(F("DNS Server: "));
	Serial.println(m_DNSServer);
	Serial.print(F("NTP Server: "));
	Serial.println(m_NTPServer);

	//Init Time. If NTP Sync fails this will be used.
	setTime(0, 0, 0, 1, 1, 2013);

	if (isNTPEnabled()) {
		Serial.println(F("Syncing time using NTP..."));
		enableNTP();
	}

	m_GUIServer = new GUIServer(4242);
}
开发者ID:corrado72,项目名称:Aquaduino-Next,代码行数:45,代码来源:Aquaduino.cpp


示例2: put_1_svc

int *
put_1_svc(struct clientData *argp, struct svc_req *rqstp)
{
    int *result = (int *)malloc(sizeof(int));

    if (result == NULL) {
        perror("Error: Result failed.");
        int n;
        result = &n;
    }

    *result = -1;
    setTime();
    printf("[%s]\n A put request is received %d.\n", currTime, argp->id);
    fflush(stdout);

    if (index1 < Limit){
        int CID = -1;

        for (int i = 0; i < 3; i++) {

            if (clientList[i] == argp->id){
                CID = i;
                break;
            }
        }

        if (strcpy(client_msgs[index1].message, argp->message) != NULL){

            client_msgs[index1].id = argp->id;
            client_msg_ids[index1] = argp->id;

            if (CID == -1){
                clientList[numClient] = argp->id;
                numClient += 1;
            }
            index1 += 1;
            *result = 0;

        } else {
            perror("Error: Putting message Failure.");
        }
    }
    return result;
}
开发者ID:YuanjingShi,项目名称:eecs338,代码行数:45,代码来源:as7_server.c


示例3: setTime

	Bitmap& Movie::bitmap()
	{
		if (m_currentTime == -1)
			setTime(0);

		if (m_needBitmap)
		{
			m_needBitmap = false;
			if (!internalBitmap(m_bitmap))
			{
				BitmapLock bmp(m_bitmap);
				if (bmp.locked())
					bmp.reset();
			}
		}

		return m_bitmap;
	}
开发者ID:mbits-os,项目名称:gfx,代码行数:18,代码来源:Movie.cpp


示例4: main

void main ( void )
{
  WDTCTL = WDTPW + WDTHOLD;             // Stop watchdog timer
  setTime( 0x12, 0, 0, 0);              // initialize time to 12:00:00 AM

  P1DIR |= 0x01;                        // Set P1.0 to output direction
  CCR0 = 32768-1;
  TACTL = TASSEL_1+MC_1;                // ACLK, upmode
  CCTL0 |= CCIE;                        // enable CCRO interrupt
  _EINT();

  while( 1 )
  {
    LPM3;                               // enter LPM3, clock will be updated
    P1OUT ^= 0x01;                      // do any other needed items in loop
    _NOP();                             // set breakpoint here to see 1 second interrupt
  }
}
开发者ID:HowAboutIt,项目名称:yawing,代码行数:18,代码来源:TA_example2.c


示例5: m3ExtraCycles

void Mode0Irq::mode3CyclesChange() {
	unsigned long nextTime = lyCounter.time() - lyCounter.lineTime();
	unsigned nextLy = lyCounter.ly();
	
	if (time() > lyCounter.time()) {
		nextTime += lyCounter.lineTime();
		++nextLy;
		
		if (nextLy > 143) {
			nextTime += lyCounter.lineTime() * (154 - nextLy);
			nextLy = 0;
		}
	}
	
	nextTime += (baseCycle(lyCounter.isDoubleSpeed()) + m3ExtraCycles(nextLy)) << lyCounter.isDoubleSpeed();
	
	setTime(nextTime);
}
开发者ID:Arnethegreat,项目名称:bsnes-plus,代码行数:18,代码来源:mode0_irq.cpp


示例6: setTime

void MainWindow::resetTimeSlider()
{
    if(dataSet_ != NULL)
    {
        timeSlider_->setMinimum(0);
        timeSlider_->setMaximum(dataSet_->getNumTimes() - 1);

        if(time_ >= dataSet_->getNumTimes())
        {
            setTime(0);
        }
    }
    else
    {
        timeSlider_->setMinimum(0);
        timeSlider_->setMaximum(0);
    }
}
开发者ID:knolla,项目名称:PanFluExercise,代码行数:18,代码来源:MainWindow.cpp


示例7: NxObject

NxCursor::NxCursor(NxObjectFactoryInterface *parent, QTreeWidgetItem *ccParentItem, UiRenderOptions *_renderOptions) :
    NxObject(parent, ccParentItem, _renderOptions) {
    glListCursor = glGenLists(1);
    curve = 0;
    setTimeLocal(0);
    nextTimeOld = 0;
    timeOld = 0;
    time = 0;
    timeLocal = 0;
    timeLocalOld = 0;
    timeLocalAbsolute = 0;
    previousCursorReliable = false;
    previousPreviousCursorReliable = false;
    cursorAngleCacheSinZ = cursorAngleCacheCosZ = cursorAngleCacheSinY = cursorAngleCacheCosY = 0;
    cursorPoly       = NxPolygon(4);
    cursorPoly[0]    = NxPoint();
    cursorPoly[1]    = NxPoint();
    cursorPoly[2]    = NxPoint();
    cursorPoly[3]    = NxPoint();
    cursorPolyOld    = NxPolygon(4);
    cursorPolyOld[0] = NxPoint();
    cursorPolyOld[1] = NxPoint();
    cursorPolyOld[2] = NxPoint();
    cursorPolyOld[3] = NxPoint();
    setNbLoop(0);
    setStart("1 0");
    setTimeFactor(1);
    setTimeFactorF(1);
    setWidth(1);
    setDepth(0);
    setTime(0);
    setSize(1.2);
    setLineFactor(1);
    setLineStipple(0xFFFF);
    setColorActive("cursor_active");
    setColorInactive("cursor_inactive");
    setTimeStartOffset(0);
    setTimeEndOffset(0);
    setTimeInitialOffset(0);
    setEasing(0);
    setBoundsSource("-10 10 -10 10 -10 10");
    setBoundsTarget("0 1 0 1 0 1");
    boundsSourceIsBoundingRect = true;
}
开发者ID:AlanStones,项目名称:IanniX,代码行数:44,代码来源:nxcursor.cpp


示例8: setTime

bool QCamQHY5::updateFrame() {
   // get the frame buffer
   void* YBuff=NULL;
   YBuff=inputBuffer_.YforOverwrite();
   // read picture datas
   if(camera->read((unsigned char*)YBuff,shootMode_,denoise_)) {
      setTime();
      camera->configure(xstart_,ystart_,width_,height_,gainG1_,gainB_,gainR_,gainG2_,&width_,&height_);
      // count the usb transfer time. Rate is 24M pixels / second
      shootMode_=(frameExposure_<1000);
      int poseTime=frameExposure_-(1558*(height_+26)/PIXEL_RATE);
      if(poseTime<0) poseTime=0;
      camera->shoot(poseTime,shootMode_);
      shooting_=TRUE;
      // gives a new shot for the timer
      timer_->setSingleShot(true);
      timer_->start(frameExposure_);
      // set the output frame
      if((targetWidth_==1280)&&(targetHeight_==1024)) {
          // nothing to resize
          yuvBuffer_=inputBuffer_;
      } else {
         switch(croppingMode) {
            case SCALING :
               yuvBuffer_.scaling(inputBuffer_,targetWidth_,targetHeight_);
               break;
            case CROPPING :
               // cropping allready done by driver
               yuvBuffer_=inputBuffer_;
               break;
            case BINNING :
               yuvBuffer_.binning(inputBuffer_,targetWidth_,targetHeight_);
               break;
         }
      }
      // publish the frame
      newFrameAvaible();
      // update progress bar if needed
      if(frameExposure_>(3*PROGRESS_TIME)) {
         progressBar->reset();
         progress_=0;
      }
   }
}
开发者ID:thx8411,项目名称:qastrocam-g2,代码行数:44,代码来源:QCamQHY5.cpp


示例9: localtime

void dtg::setDtg( time_t cttime )
{
   struct tm * tms = localtime( &cttime );  // NB static data area!
   if ( tms->tm_isdst != 0 )
      tms->tm_hour -= 1;

   std::string curTime;
   std::string curDate;

   curTime = ( boost::format( "%02.2d:%02.2d:%02.2d" ) % tms->tm_hour % tms->tm_min % tms->tm_sec ).str();

   int year = tms->tm_year;
   while ( year > 99 )
      year -= 100;			// take it back to two chars

   curDate = ( boost::format( "%02.2d/%02.2d/%02.2d" ) % tms->tm_mday % ( tms->tm_mon + 1 ) % year ).str();
   setTime( curTime, DTGDISP );
   setDate( curDate, DTGDISP );
}
开发者ID:BackupTheBerlios,项目名称:minos-svn,代码行数:19,代码来源:mwin.cpp


示例10: if

void Wait::loadData(const QVariantMap & data, bool internal)
{
    if  (!internal)
        Action::loadData(data, internal);

    if (data.contains("time") && data.value("time").canConvert(QVariant::Double))
        setTime(data.value("time").toDouble());

    if (data.contains("waitType") && data.value("waitType").type() == QVariant::String) {
        QString type = data.value("waitType").toString();

        if (type ==  "Timed")
            setWaitType(Wait::Timed);
        else if (type == "Forever")
            setWaitType(Wait::Forever);
        else
            setWaitType(Wait::MouseClick);
    }
}
开发者ID:fr33mind,项目名称:Belle,代码行数:19,代码来源:wait.cpp


示例11: now

time_t now(){
  while( millis() - prevMillis >= 1000){      
    sysTime++;
    prevMillis += 1000; 
#ifdef TIME_DRIFT_INFO
    sysUnsyncedTime++; // this can be compared to the synced time to measure long term drift     
#endif  
  }
  if(nextSyncTime <= sysTime){
        if(getTimePtr != 0){
          time_t t = getTimePtr();
      if( t != 0)
        setTime(t);
      else
        Status = (Status == timeNotSet) ?  timeNotSet : timeNeedsSync;        
    }
  }  
  return sysTime;
}
开发者ID:r24y,项目名称:Iridium9612,代码行数:19,代码来源:IridTime.cpp


示例12: setTime

void DigitalTube::invoke(long command){
  
    if(isDigital(command)){
      setTime(getDigital(command));
      return;
    }
    if(command==KEY_BACK){
      leftMove();
      return;
    }
    if(command==KEY_FORWARD){
      rightMove();
      return;
    }
    if(command==KEY_PLAY){
      startTimer();
      return;
    }
}
开发者ID:drinking,项目名称:TimeSwitch,代码行数:19,代码来源:DigitalTube.cpp


示例13: testMissingParam

void testMissingParam(CuTest *tc) {
 // The 3 parameters are required, so we should get an HTTP error if they are missing
    struct Request req = {"GET", "/query", NULL, NULL};

    time_t now = makeTs("2009-11-08 10:00:00");
    setTime(now);

    int tmpFd = makeTmpFile();
    processQueryRequest(tmpFd, &req);

    char* result = readTmpFile();

    CuAssertStrEquals(tc,
        "HTTP/1.0 500 Bad/missing parameter" HTTP_EOL
        "Server: BitMeterOS " VERSION " Web Server" HTTP_EOL
        "Date: Sun, 08 Nov 2009 10:00:00 +0000" HTTP_EOL
        "Connection: Close" HTTP_EOL HTTP_EOL
    , result);
}
开发者ID:JackWangCUMT,项目名称:bitmeteros,代码行数:19,代码来源:testHandleQuery.c


示例14: startRec

void startRec()
{
	if(RecFlag == 0)
	{	
		setWindow(window,"mohnish/gb-drum-kit record1.jpg");
		printf("%d-Tempo \n",Tempo);
		setTempo(Tempo);
		setTime(4,4);
		openOutput(SongName,0,0);
		RecFlag = 1;
		PlayFlag = 1;
	}
	else
	{
		closeOutput();
		setWindow(window,"mohnish/gb-drum-kit changed1.jpg");
		RecFlag = 0;
	}	
}
开发者ID:Mohnish-SPU,项目名称:DrumHero,代码行数:19,代码来源:main.c


示例15: QTime

void Validity::hideTime(bool hide)
{
	if (hide) {
		QString format;
		if (!endDate)
			format = QTime(0,0,0).toString(formatDate);
		else
			format = QTime(23,59,59).toString(formatDate);
		if (!midnight && endDate)
			setDateTime(dateTime().addDays(-1));
		midnight = true;
		setDisplayFormat(format);
	} else {
		setDisplayFormat(formatDate);
		if (midnight && endDate)
			setDateTime(dateTime().addDays(1));
		midnight = false;
		setTime(mytime);
	}
}
开发者ID:LiTianjue,项目名称:xca,代码行数:20,代码来源:validity.cpp


示例16: setScale

void AutoDragger::autoDrag(DisplayElement *dragElement, const Common::Point &startPoint, const Common::Point &stopPoint,
		TimeValue dragTime, TimeScale dragScale) {
	_draggingElement = dragElement;

	if (_draggingElement) {
		_startLocation = startPoint;
		_stopLocation = stopPoint;
		_lastTime = 0;
		_done = false;
		_draggingElement->moveElementTo(_startLocation.x, _startLocation.y);
		setScale(dragScale);
		setSegment(0, dragTime);
		setTime(0);
		scheduleCallBack(kTriggerAtStop, 0, 0);
		startIdling();
		start();
	} else {
		stopDragging();
	}
}
开发者ID:AlbanBedel,项目名称:scummvm,代码行数:20,代码来源:autodragger.cpp


示例17: get_1_svc

int *
get_1_svc(int *argp, struct svc_req *rqstp)
{
    int *result = (int *)malloc(sizeof(int));
    if (result == NULL) {
        perror("Error: Result failed.");
        int n;
        result = &n;
    }
    *result = -1;

    setTime();
    printf("[%s]\n A Get:%d request received from client.\n", currTime, *argp);
    fflush(stdout);

    int CID = -1;
    // RCID: real client id
    int RCID = *argp;

    for (int i = 0; i < 3; i++) {
        if (clientList[i] == RCID){
            CID = i;
            break;
        }
    }

    for (i = 0; i < Limit; i++){

        if (i > clientIndex[CID] && CID >= 0 && CID <= 2 ){

            if (client_msg_ids[i] >= 0 && client_msg_ids[i] != RCID ){

                *result = 0;
                clientIndex[CID] = i;
                return result;
                
            }
        }
    }
    return result;
}
开发者ID:YuanjingShi,项目名称:eecs338,代码行数:41,代码来源:as7_server.c


示例18: word

int NTPClient::receive()
{
  int nbyte = m_udp->parsePacket();
  if (nbyte > 0)
  {
    // We've received a packet, read the data from it
    m_udp->read(m_packetBuffer, NTP_PACKET_SIZE); // read the packet into the buffer

    //the timestamp starts at byte 40 of the received packet and is four bytes,
    // or two words, long. First, esxtract the two words:
    unsigned long highWord = word(m_packetBuffer[40], m_packetBuffer[41]);
    unsigned long lowWord = word(m_packetBuffer[42], m_packetBuffer[43]);

    /* DEBUG */
    unsigned long secsSince1900 = highWord << 16 | lowWord;

    // now convert NTP time into everyday time:
    // Unix time starts on Jan 1 1970. In seconds, that's 2208988800:
    const unsigned long seventyYears = 2208988800UL;
    // subtract seventy years:
    unsigned long epoch = secsSince1900 - seventyYears;

    // combine the four bytes (two words) into a long integer
    // this is NTP time (seconds since Jan 1 1900):
    time_t ntptime = highWord << 16 | lowWord;

    // now convert NTP time into everyday time:
    // Unix time starts on Jan 1 1970. In seconds, that's 2208988800:
//	    const unsigned long seventyYears = 2208988800UL;

    // subtract seventy years:
    ntptime -= seventyYears;

    setTime(ntptime);
  } else
  {
    return 0;
  }
  return 1;

}
开发者ID:csipiemonte,项目名称:smartlab,代码行数:41,代码来源:ntpclient.cpp


示例19: setState

bool CalAnimationAction::execute(float delayIn, float delayOut, float weightTarget, bool autoLock)
{

  // You cannot execute a manual action.
  if( m_sequencingMode == SequencingModeManual ) {
    return false;
  }
  
  setState(STATE_IN);
  setWeight(0.0f);
  m_delayIn = delayIn;
  m_delayOut = delayOut;
  setTime(0.0f);
  m_weightTarget = weightTarget;
  m_autoLock = autoLock;
  m_sequencingMode = SequencingModeAutomatic;
  m_manualOn = false; // Irrelevant since not manual.
  m_rampValue = 1.0;
  m_compositionFunction = CompositionFunctionNull; // Initially NULL so we can recognize when it changes.
  return true;
}
开发者ID:i25ffz,项目名称:cal3d-android,代码行数:21,代码来源:animation_action.cpp


示例20: if

//Function to calculate the time elapsed
void TimeClock::calcTimeElapsed(int start, int end)
{
    int tempHours;     //Temporary variable to hold the difference in time
    int tempMinutes;   //Temporary stores the minutes
    int tempTime;      //Time to be passed to the setTime function
    int stHours;       //Starting hours
    int enHours;       //Ending hours
    int stMinutes;     //Starting Minutes
    int enMinutes;     //Ending minutes
    
    //Separating hours from minutes
    stHours = start/100;
    enHours = end/100;
    stMinutes = start % 100;
    enMinutes = end % 100;
    
    //Calculating difference between hours
    if(stHours <= enHours)
        tempHours = enHours - stHours;
    else if(stHours > enHours)
        tempHours = (24 - stHours) + enHours;
    
    //Calculating difference between minutes
    if(stMinutes <= enMinutes)
        tempMinutes = enMinutes - stMinutes;
    else if(stMinutes > enMinutes)
    {
        tempMinutes = (60 - stMinutes) + enMinutes;
        tempHours -= 1;
    }
    
   
    //Putting difference in minutes and hours together
    tempTime = (tempHours * 100) + tempMinutes;
    
    //Function from the MilTime class
    
    setTime(tempTime, 0);
                
}
开发者ID:ProTapia,项目名称:Cruz-TapiaJuan_CSC17a_48130,代码行数:41,代码来源:TimeClock.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ setTimeout函数代码示例发布时间:2022-05-30
下一篇:
C++ setTile函数代码示例发布时间: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