Exemplo n.º 1
0
UINT	TimeManager::CurrentDate()
{
	__ENTER_FUNCTION

		SetTime( ) ;
	UINT Date;
	ConvertTU(&m_TM,Date);

	return Date;

	__LEAVE_FUNCTION

		return 0;
}
Exemplo n.º 2
0
TEST(time, timer_create_NULL) {
  // A NULL sigevent* is equivalent to asking for SIGEV_SIGNAL for SIGALRM.
  timer_t timer_id;
  ASSERT_EQ(0, timer_create(CLOCK_MONOTONIC, NULL, &timer_id));

  ScopedSignalHandler ssh(SIGALRM, timer_create_NULL_signal_handler);

  ASSERT_EQ(0, timer_create_NULL_signal_handler_invocation_count);

  SetTime(timer_id, 0, 1, 0, 0);
  usleep(500000);

  ASSERT_EQ(1, timer_create_NULL_signal_handler_invocation_count);
}
Exemplo n.º 3
0
// Write a function that fills the gData array with random numbers between 1 and MAX_RANDOM_NUMBER
// If indexForZero is valid and non-negative, set the value at that index to zero 
void GenerateInput(int size, int indexForZero) {
	printf("Filling Array...\n");
	int i;
	SetTime();
	for(i=0; i < size; i++){
		if(indexForZero > 0 && indexForZero == i){
			gData[i] = 0;
		}else{
			gData[i] = GetRand(1,MAX_RANDOM_NUMBER);
		}	
	}
	printf("%d\r",i);
	printf("Array Fill took %lu ms \n",GetTime());
}
Exemplo n.º 4
0
func Zeit(int iZeit)
{
	CanClose = 1;
	CloseMenu(GetCursor());
	Log("<c ffcc00>%d Minuten Aufbauzeit</c>",iZeit);
	SetTime(iZeit,0);
	CreateMenu(MEPU, GetCursor(), 0, 0,"Geldeinstellungen", 0, 1,1,17);
	CanClose = 0;
	AddMenuItem("100 Clunker", Format("Geld(%d)",100),MEPU, GetCursor());
	AddMenuItem("200 Clunker", Format("Geld(%d)",200),MEPU, GetCursor());
	AddMenuItem("500 Clunker", Format("Geld(%d)",500),MEPU, GetCursor());
	AddMenuItem("1000 Clunker", Format("Geld(%d)",1000),MEPU, GetCursor());
	AddMenuItem("2000 Clunker", Format("Geld(%d)",2000),MEPU, GetCursor());
}
Exemplo n.º 5
0
//初始化
void CExtraExpActivity::Init(int nActivityID, const char * szBeginTime, const char * szEndTime,
							 const char * szStartTime, const char * szStopTime, unsigned short nReewardExpRate)
{
	int nStartHour = 0;
	int nStartMinute = 0;
	sscanf(szStartTime, "%2d:%2d", &nStartHour, &nStartMinute);
	int nStopHour = 0;
	int nStopMinute = 0;
	sscanf(szStopTime, "%2d:%2d", &nStopHour, &nStopMinute);

	m_nActivityID = nActivityID;
	m_nRewardExpRate = nReewardExpRate;
	CDayTimeBlockActivity::Init(nStartHour, nStartMinute, nStopHour, nStopMinute, SetTime(szBeginTime), SetTime(szEndTime));
}
void FAnimLinkableElement::LinkSequence(UAnimSequenceBase* Sequence, float AbsSequenceTime)
{
	if(Sequence && Sequence->SequenceLength > 0)
	{
		LinkedMontage = nullptr;
		LinkedSequence = Sequence;
		SegmentIndex = 0;

		SegmentBeginTime = 0.0f;
		SegmentLength = Sequence->SequenceLength;

		SetTime(AbsSequenceTime);
	}
}
	void EventComponent::AddEvent(shared_ptr<Event> event)
	{
		if (event->GetEventType() != EVT_MOVE)
			mEventList[event->GetEventType()].push_back(event);
		else // Unpack move events.
		{
			auto mov = static_pointer_cast<MoveEvent>(event);
			auto mxe = make_shared<MoveXEvent>();
			auto mye = make_shared<MoveYEvent>();
			
			mxe->SetTime(event->GetTime());
			mye->SetTime(event->GetTime());
			mxe->SetEndTime(event->GetEndTime());
			mye->SetEndTime(event->GetEndTime());

			mxe->SetValue(mov->GetValue().x);
			mye->SetValue(mov->GetValue().y);
			mxe->SetEndValue(mov->GetEndValue().x);
			mye->SetEndValue(mov->GetEndValue().y);

			mEventList[mxe->GetEventType()].push_back(mxe);
			mEventList[mye->GetEventType()].push_back(mye);
		}
	}
Exemplo n.º 8
0
   virtual Bool_t Notify()
   {
      // stop timer
      TurnOff();

      // so some action here
      TDatime d;
      m_label->SetText(d.AsString());
      gEve->GetDefaultGLViewer()->RequestDraw();

      // start timer
      SetTime(1000);
      Reset();
      TurnOn();
      return true;
   }
Exemplo n.º 9
0
/******************************Public*Routine******************************\
* Run
\**************************************************************************/
HRESULT CVMR9Subgraph::Run()
{
    HRESULT hr = S_OK;

    if( !m_pMc )
    {
        return E_UNEXPECTED;
    }
	LONGLONG  llCur= 0; LONGLONG  llDur = 0;
	hr = GetTimes(llCur,  llDur);
	if(llCur == llDur)
		SetTime(0);
    hr = m_pMc->Run();

    return hr;
}
Exemplo n.º 10
0
bool Time::SetDate ( std::string line )
{
	int hr, min, m, d, y;
	std::string dat;
	if ( line.substr ( 0, 1 ) == " " ) 
		dat = line.substr ( 1, line.length()-1 ).c_str();
	else 
		dat = line;

	hr = 0;
	min = 0;
	m = atoi ( dat.substr ( 0, 2).c_str () );
	d = atoi ( dat.substr ( 3, 2).c_str () );
	y = atoi ( dat.substr ( 6, 4).c_str () );
	return SetTime ( hr, min, m, d, y);
}
Exemplo n.º 11
0
bool Demo::HandleEvent( sf::Event &e )
{
    if( e.Type == sf::Event::KeyPressed ) {
        switch( e.Key.Code ) {
            case( sf::Key::Return ):
                Reset();
                break;
            case sf::Key::Space:
                Toggle();
                break;
            case sf::Key::G:
                SetTime( 10.0 );
                break;
            case sf::Key::Num1:
                SetSpeed( 0.5 );
                break;
            case sf::Key::Num2:
                SetSpeed( 1.0 );
                break;
            case sf::Key::Num3:
                SetSpeed( 2.0 );
                break;
            case sf::Key::S:
                ShuffleNext();
                break;
            case sf::Key::C:
                ++count;
                Tree::debug_persist( "persist", "count %d", count );
                break;
            case sf::Key::R:
                Tree::debug_remove( "persist" );
                break;
            case sf::Key::F10:
                Tree::exit();
                break;
            case sf::Key::Q:
                BOOST_ASSERT(!"DIE DIE DIE");
                break;
            /*case sf::Key::W:
                BOOST_ASSERT_MSG(1 == 0, "Slower death\n");
                break;*/
            default:
                break;
        }
    }
    return true;
}
Exemplo n.º 12
0
//Set time on the internal timer
static int _F4_Handler (void)
{
	TimeAndDate CurrentTime;
	//<year> <month> <day> <dow> <hr> <min> <sec>
	CurrentTime.year	= argAsInt(1);
	CurrentTime.month	= argAsInt(2);
	CurrentTime.day		= argAsInt(3);
	CurrentTime.dow		= argAsInt(4);
	CurrentTime.hour	= argAsInt(5);
	CurrentTime.min		= argAsInt(6);
	CurrentTime.sec		= argAsInt(7);
	SetTime(CurrentTime);
	printf_P(PSTR("Setting %02u/%02u/%04u %02u:%02u:%02u"), CurrentTime.month, CurrentTime.day, CurrentTime.year, CurrentTime.hour, CurrentTime.min, CurrentTime.sec);
	
	printf_P(PSTR("......Done\n"));
	return 0;
}
Exemplo n.º 13
0
BOOL CTimeStamp::SetTime(const tm& t)
{
	SetInvalidTime();

	SYSTEMTIME SystemTime;
	SystemTime.wYear = t.tm_year+1900;
	SystemTime.wMonth = t.tm_mon+1;
	SystemTime.wDayOfWeek = t.tm_wday;
	SystemTime.wDay = t.tm_mday;
	SystemTime.wHour = t.tm_hour;
	SystemTime.wMinute = t.tm_min;
	SystemTime.wSecond = t.tm_sec;
	SystemTime.wMilliseconds = 0;
	SetTime(SystemTime);

	return IsValid();
}
Exemplo n.º 14
0
//全体動作
int CBossMystiaMiddle::Thread(){
	TSunFunctionCallback<CBossMystiaMiddle> fn;
	TSunFunctionCallback<CBossMystiaBase> fnb;

	//出現
	flag = 0;
	deffence = 0;
/*
	for( int i = 0; i < 46; i++ ){
		x -= 5;
		mt3.Suspend();
	}
	mt3.Suspend(30);
*/
	//会話
	g_pPlayer->Talk();
	pTalk = new CTalkMystia1();
	pTalk->Start();
	while( !pTalk->IsEnd() )
		mt3.Suspend();
	SAFE_DELETE(pTalk);
	g_pPlayer->Resume();

	//通常攻撃
	SetHP(1000);
	SetTime(20);
	fnb.SetFunction(this,&CBossMystiaBase::NormalAtack1);
	mt.Start(&fnb,0x8000);
	while( !IsEnd() ) mt3.Suspend();
	mt.Stop();

	this->AddItem(ITEM_1UP,1);

	//エフェクト
	flag = 0;
	deffence = 0;
	g_lEffect.Add( new CEffectBreak( GetX(), GetY() ));
	mt3.Suspend( 60 );

	//退却
	for( int i = 0; i < 46; i++ ){
		x += 5;
		mt3.Suspend();
	}
	return 1;
}
Exemplo n.º 15
0
XBOOL XTime::SetTime(XString8 &strTime)
{
	//int id=strTime.Find(',');
	//if(id<3) return XFALSE;
	XU32 is=0,id=0;
	XU16 nYear=0,nMon=0,nDay=0,nHour=0,nMin=0,nSec=0;
	while(id<=strTime.GetLength())
	{
		if(strTime[id]==' '||strTime[id]==','||strTime[id]=='-'||strTime[id]==0)
		{
			if(id>is+1)
			{
				XString8 str;
				strTime.Mid(str,is,id-is);
				XString8Array list;
				list.SplitString(str,':');
				if(list.GetSize()>1)
				{
					nHour=list[0].ToInt();
					nMin=list[1].ToInt();
					if(list.GetSize()>2)
						nSec=list[2].ToInt();
				}
				else 
				{
					int id=Month(str);
					if(id>0&&id<=12&&nMin<1) nMon=id;
					else 
					{
						id=str.ToInt();
						if(id>0&&id<32&&nDay<1) nDay=id;
						else if(id>=1900) nYear=id;
						else nHour=id;
					}
				}
			}
			id++;
			is=id;
		}
		id++;
	}
	if(nYear<1900||nMon<1||nDay<1) return XFALSE;
	SetTime(nYear,nMon,nDay,nHour,nMin,nSec);
	return XTRUE;
}
Exemplo n.º 16
0
void CMdbPara::SetNumber(register uint32 nFieldNo, register void* pVal, register uint32 nOperator)
{
	switch(GetType(nFieldNo))
	{
	case MDB_INT8_FIELD:
		SetInt8(nFieldNo, *(int8*)pVal, nOperator);
		break;
	case MDB_INT16_FIELD:
		SetInt16(nFieldNo, *(int16*)pVal, nOperator);
		break;
	case MDB_INT32_FIELD:
		SetInt32(nFieldNo, *(int32*)pVal, nOperator);
		break;
	case MDB_INT64_FIELD:
		SetInt64(nFieldNo, *(int64*)pVal, nOperator);
		break;
	case MDB_UINT8_FIELD:
		SetUInt8(nFieldNo, *(uint8*)pVal, nOperator);
		break;
	case MDB_UINT16_FIELD:
		SetUInt16(nFieldNo, *(uint16*)pVal, nOperator);
		break;
	case MDB_UINT32_FIELD:
		SetUInt32(nFieldNo, *(uint32*)pVal, nOperator);
		break;
	case MDB_UINT64_FIELD:
		SetUInt64(nFieldNo, *(uint64*)pVal, nOperator);
		break;
	case MDB_FLOAT_FIELD:
		SetFloat(nFieldNo, *(float*)pVal, nOperator);
		break;
	case MDB_DOUBLE_FIELD:
		SetDouble(nFieldNo, *(double*)pVal, nOperator);
		break;
	case MDB_DATE_FIELD:
		SetDate(nFieldNo, *(CDate*)pVal, nOperator);
		break;
	case MDB_TIME_FIELD:
		SetTime(nFieldNo, *(CTime*)pVal, nOperator);
		break;
	case MDB_DATETIME_FIELD:
		SetDateTime(nFieldNo, *(CDateTime*)pVal, nOperator);
		break;
	}
}
Exemplo n.º 17
0
/**
 * Set the RTC time to UTC using the GPS fix data.
 *
 * @param gps pointer to GPSData object
 */
void ISL12026::SetTime(const GPSData *gps)
{
    RTCTime rtc;

    // Ignore the request if we don't have a valid fix.
    if (gps->fixType == GPSData::NoFix)
        return;

    rtc.seconds = gps->seconds;
    rtc.minutes = gps->minutes;
    rtc.hours = gps->hours;

    rtc.month = gps->month;
    rtc.day = gps->day;
    rtc.year = gps->year;

    SetTime (&rtc);
}
Exemplo n.º 18
0
void	QuickParameters::ReinitCombo()
{
	CRCombo* combo;
	targtype=0,targentry=0;
	for (int t=0;t<4;t++)
		for (int e=0;e<4;e++)
			if(CSQuick1::quickdef.targets[t][e]==CSQuick1::quickdef.target)
				targtype=t,targentry=e;

	combo=GETDLGITEM(IDC_TARGTYPE);
	combo->Clear();
	combo->AddString(LoadResString(CSQuick1::quickdef.targtypeIDs[0]));
	if (CSQuick1::quickdef.targtypeIDs[1])
		combo->AddString(LoadResString(CSQuick1::quickdef.targtypeIDs[1]));
	if (CSQuick1::quickdef.targtypeIDs[2])
		combo->AddString(LoadResString(CSQuick1::quickdef.targtypeIDs[2]));
	if (CSQuick1::quickdef.targtypeIDs[3])
		combo->AddString(LoadResString(CSQuick1::quickdef.targtypeIDs[3]));
	if (CSQuick1::quickdef.targtypeIDs[0])
		combo->SetIndex(targtype);

	TargNameCombo();


	SWord Latitude = 51;												//RDH 25/02/00
	MMC.Sky.SetMissionDawnDusk(Latitude, MMC.currdate, MMC.dawntime, MMC.dusktime);

	int timeindex = CSQuick1::quickdef.time;
	SetTime(timeindex);
	

	combo=GETDLGITEM(IDC_TIME);
	combo->Clear();
	combo->RESCOMBO(DAWN,4)->SetIndex(timeindex);

	int weatherindex = CSQuick1::quickdef.weather;
	SetWeather(weatherindex);


	combo=GETDLGITEM(IDC_CLOUD);
	combo->Clear();
	combo->RESCOMBO(CLEARSKY,4)->SetIndex(weatherindex);

}
Exemplo n.º 19
0
//陰陽「太極図」
int CBossChenMiddle::Taikyoku()
{
    flag = 1;
    deffence = 1;
    SetHP(2000);
    SetTime(40);
    Suspend(60);

    for( int i = 0; i < 60; ++i ) {
        x += ( 450 - GetX() ) / 60;
        y += ( GAME_CENTER_Y - GetY() ) / 60;
        mt.Suspend(1);
    }

    CTamaTaikyoku tama;
    tama.x = GetX();
    tama.y = GetY();
    tama.type = 12;
    tama.v = 3;
    int offset = 0.0;
    while(1) {
        for( int i = 0;; i++) {
            //攻撃
            tama.color = 1;
            tama.a = offset;
            g_lTama.Add( tama.Copy() );
            tama.color = 0;
            tama.a = offset + 180;
            g_lTama.Add( tama.Copy() );

            g_pMaterial->sndFire.Play(0);
            double m;
            if( GetDifficult() == DIFF_LUNATIC )
                m = 1.5*(4-GetDifficult());
            else
                m = 2.0*(4-GetDifficult());

            if( i > 120/m )
                offset += 3.0*m*Sin((double)i*2);
            this->Suspend(m);
        }
    }
    return 1;
}
Exemplo n.º 20
0
CInPlaceDateTime::CInPlaceDateTime(CWnd* pParent, CRect& rect, UINT nID,
								   int nRow, int nColumn,
								   COLORREF crFore, COLORREF crBack,
								   UINT nFirstChar, LPCTSTR format,
								   CGridCellDateTime *pcell)
{
	m_nRow          = nRow;
	m_nCol          = nColumn;
	m_crForeClr     = crFore;
	m_crBackClr     = crBack;
	m_nLastChar     = 0;
	m_bExitOnArrows = FALSE;
	m_pcell         = pcell;

	DWORD dwStl = WS_BORDER|WS_VISIBLE|WS_CHILD|DTS_SHORTDATEFORMAT|DTS_UPDOWN;

	if (!Create(dwStl, rect, pParent, nID)) {
		return;
	}

	DateTime_SetFormat(m_hWnd, (LPARAM)format);
	SetTime(pcell->GetTime());

	SetFont(pParent->GetFont());
	SetFocus();

	switch (nFirstChar)
	{
		case VK_LBUTTON:
		case VK_RETURN: return;
		case VK_BACK:   break;
		case VK_DOWN:
		case VK_UP:
		case VK_RIGHT:
		case VK_LEFT:
		case VK_NEXT:
		case VK_PRIOR:
		case VK_HOME:
		case VK_END:    return;
		default:        break;
	}
	SendMessage(WM_CHAR, nFirstChar);
}
Exemplo n.º 21
0
TEST(time, timer_create_multiple) {
  Counter counter1(Counter::CountNotifyFunction);
  counter1.Create();
  Counter counter2(Counter::CountNotifyFunction);
  counter2.Create();
  Counter counter3(Counter::CountNotifyFunction);
  counter3.Create();

  ASSERT_EQ(0, counter1.value);
  ASSERT_EQ(0, counter2.value);
  ASSERT_EQ(0, counter3.value);

  SetTime(counter2.timer_id, 0, 1, 0, 0);
  usleep(500000);

  EXPECT_EQ(0, counter1.value);
  EXPECT_EQ(1, counter2.value);
  EXPECT_EQ(0, counter3.value);
}
Exemplo n.º 22
0
void TimeEdit::PasteTime() {
    if (byFrame) {
        Paste();
        return;
    }

    std::string text(GetClipboard());
    if (text.empty()) return;

    AssTime tempTime(text);
    if (tempTime.GetAssFormated() == text) {
        SetTime(tempTime);
        SetSelection(0, GetValue().size());

        wxCommandEvent evt(wxEVT_TEXT, GetId());
        evt.SetEventObject(this);
        HandleWindowEvent(evt);
    }
}
	void SceneManager::SetToOutdoor()
	{
		/*Main::Instance().GetOgreSceneMgr()->setSkyBox(true, "Skybox/LostValley");
		Main::Instance().GetOgreSceneMgr()->getSkyBoxNode()->getAttachedObject(0)->setVisibilityFlags( Ice::VisibilityFlags::V_SKY);
		Ogre::Light *Light = Main::Instance().GetOgreSceneMgr()->createLight("Light0");
		Light->setType(Ogre::Light::LT_DIRECTIONAL);
		Light->setDirection(0, -1, 0.9);
		Light->setDiffuseColour(2, 2, 2);
		Light->setSpecularColour(Ogre::ColourValue(1, 0.9, 0.6));*/
		
		if (!mWeatherController) mWeatherController = ICE_NEW WeatherController();
		SetTimeScale(mTimeScale);
		SetTime(11, 0);
		mIndoorRendering = false;

		if (!mWeatherController->GetCaelumSystem()->getSun()->getForceDisable())
			AIManager::Instance().RegisterLight(mWeatherController->GetCaelumSystem()->getSun()->getMainLight());
		else AIManager::Instance().RegisterLight(mWeatherController->GetCaelumSystem()->getMoon()->getMainLight());
	}
Exemplo n.º 24
0
void component_init()
{    
	power_screen(true);
	LED_Light(led_red, true);
	LED_Light(led_green, true);
	LED_Light(led_blue, true);
	screen_step(0);
						
	RTC_Clock clock = { 0, 0, 30, 23, 0, 8, 8, 12 };

	SetTime(&clock);
	screen_step(1);      
	screen_step(2);
		mobile_state();
	screen_step(3);
    screen_step(4);
	prepare_mobile(false);
	screen_step(5);
	
	play_media(rand() % 9 + 1);
	screen_step(6);

	{
		char szSize[piece_size];
		
		sprintf(szSize, "mount tf card %s", (pf_open("temp") == FR_OK) ? "correcttly" : "fault");
		post_trace(szSize);
	}
	screen_step(7);	
	
	screen_step(8);
	report_content("初始化过程完成,现在开始运行测试程序");
	screen_step(9);
	screen_step(10);
	
	LED_Light(led_red, false);
	LED_Light(led_green, false);
	LED_Light(led_blue, false);
	display_clear();

	power_screen(false);
}
Exemplo n.º 25
0
CInPlaceDateTime::CInPlaceDateTime(CWnd* pParent, CRect& rect, DWORD dwStyle, UINT nID,
								   int nRow, int nColumn, 
								   COLORREF crFore, COLORREF crBack,
								   CTime* pcTime,
								   UINT nFirstChar)
{
	m_crForeClr     = crFore;
	m_crBackClr     = crBack;
	m_nRow          = nRow;
	m_nCol          = nColumn;
	m_nLastChar     = 0; 
	m_bExitOnArrows = FALSE;
	m_pcTime        = pcTime;

	DWORD dwStl = WS_BORDER|WS_VISIBLE|WS_CHILD|dwStyle;

	if (!Create(dwStl, rect, pParent, nID)) {
		return;
	}

	SetTime(m_pcTime);

	SetFont(pParent->GetFont());
	SetFocus();

	switch (nFirstChar) 
	{
		case VK_LBUTTON: 
		case VK_RETURN: return;
		case VK_BACK:   break;
		case VK_DOWN: 
		case VK_UP:   
		case VK_RIGHT:
		case VK_LEFT:  
		case VK_NEXT:  
		case VK_PRIOR: 
		case VK_HOME:  
		case VK_END:    return;
		default:        break;
	}
	SendMessage(WM_CHAR, nFirstChar);
}
Exemplo n.º 26
0
BOOL TimeManager::Init( )
{
__ENTER_FUNCTION

#if defined(__WINDOWS__)
	m_StartTime = GetTickCount() ;
	m_CurrentTime = GetTickCount() ;
#elif defined(__LINUX__)
	m_StartTime		= 0;
	m_CurrentTime	= 0;
	gettimeofday(&_tstart, &tz);
#endif
	SetTime( ) ;

	return TRUE ;

__LEAVE_FUNCTION

	return FALSE ;
}
void AirsideFollowMeCarInSim::_ChangeToService()
{
	CPoint2008 waitingPos = m_pMeetingPoint->GetWaitingPosition();
	ElapsedTime tTime = ElapsedTime(2.0*waitingPos.distance(GetPosition())/GetSpeed()) + GetTime();
	SetMode(OnWaitForService);
	SetTime(tTime);
	SetPosition(waitingPos);

	if (m_pServiceFlight->GetMode() == OnTaxiToStand)
	{
		m_pServiceFlight->SetBeginFollowMeCarService();
		WirteLog(waitingPos,GetSpeed(),tTime);
		ServicingFlight();
	}
	else
	{
		SetSpeed(0);
		WirteLog(waitingPos,GetSpeed(),tTime);
	}
}
Exemplo n.º 28
0
// System commands
int8_t ModbusProcess_FC100()
{
    _u8BufferSize = 10;
    _lastCommand = _au8Buffer[COM_COM_ID];
    switch(_lastCommand)
    {
        case MB_COMMAND_RESET:
            #asm
                RESET; 
            #endasm
            break;
        case MB_COMMAND_SET_ADDRESS:
            _u8id = _au8Buffer[COM_DATA];
            eeprom_write(EE_MODBUS_ID, _u8id);
            while(WR)
                continue;
            ModbusSetExceptionStatusBit(MB_EXCEPTION_LAST_COMMAND_STATE, true);
            break;  
        case MB_COMMAND_SET_TIME:
            SetHourMin(&(_au8Buffer[COM_ADD1_HI]), &(_au8Buffer[COM_ADD1_LO]), &(_au8Buffer[COM_ADD2_LO]));
            
            //----------------
            struct tm newTime;
            newTime.tm_year = _au8Buffer[COM_ADD3_LO] + 100; // since 1900
            newTime.tm_mon = _au8Buffer[COM_ADD3_HI];
            newTime.tm_mday = _au8Buffer[COM_ADD2_HI];
            newTime.tm_hour = _au8Buffer[COM_ADD1_HI];
            newTime.tm_min = _au8Buffer[COM_ADD1_LO];
            newTime.tm_sec = _au8Buffer[COM_ADD2_LO];
            time_t newRawTime = mktime(&newTime);
            SetTime(&newRawTime);
            //----------------
            bitSet(_deviceStatus, INPUT_TIME_SET);
            ModbusSetExceptionStatusBit(MB_EXCEPTION_LAST_COMMAND_STATE, true);
            break;
    }
    uint8_t u8CopyBufferSize = _u8BufferSize + 2;
    ModbusSendTxBuffer();

    return u8CopyBufferSize;
}
Exemplo n.º 29
0
int CSendEmail::Send(const char * to , const char * subject, const char * data) 
{
	SetTime(); //设置时间
//	m_pSmtp = NULL;

	/*m_pSmtp = new CSmtp();

	if(m_pSmtp->CreateSocket()==SOCKET_ERR)
	{
		printf("create socket failure\n");
		delete m_pSmtp;
		return SOCKET_ERR;
	}
    */

    int ret = m_pSmtp->ConnectHost(m_strHost.toLatin1().data(), m_nPort);
    if( (ret == CONNECT_HOST_ERR) | (ret != SMTP_OK) )
    {
        return ret;
    }

    ret = m_pSmtp->Login(m_strUsr.toLatin1().data(), m_strPwd.toLatin1().data());
    if( (ret==PWD_ERR) || (ret == NAME_ERR) || (ret != SMTP_OK) )
    {
        return ret;
    }

    ret = m_pSmtp->SendMail(m_strFrom.toLatin1().data(), to, m_strDate.toLatin1().data(), subject, data);
	if( (ret == FROM_ERR) || (ret== TO_ERR )|| (ret != SMTP_OK))
	{	
		return ret;
	}

//	ret = m_pSmtp->End();
	if(false  == (m_pSmtp->End()))
	{
		return QUIT_ERR;
	}

	return SMTP_OK;
}
Exemplo n.º 30
0
void StrandOfTheAncient::StartRound(){
	roundprogress = SOTA_ROUND_STARTED;

	m_mainLock.Acquire();
	
	for( std::set< Player* >::iterator itr = m_players[ Attackers ].begin(); itr != m_players[ Attackers ].end(); itr++ ){
		Player *p = *itr;
		
		p->SafeTeleport( p->GetMapId(), p->GetInstanceID(), sotaAttackerStartingPosition[ SOTA_ROUND_STARTED ] );
		p->RemoveAura( BG_PREPARATION );
	}

	m_mainLock.Release();

	RemoveAuraFromTeam( Defenders, BG_PREPARATION );

	SetWorldState( WORLDSTATE_SOTA_TIMER_1, 10 );
	SetTime( ROUND_LENGTH );
	sEventMgr.AddEvent( this, &StrandOfTheAncient::TimeTick, EVENT_SOTA_TIMER, MSTIME_SECOND * 5, 0, EVENT_FLAG_DO_NOT_EXECUTE_IN_WORLD_CONTEXT );
	UpdatePvPData();
}