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


C++ setTime函数代码示例

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


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


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