void SetAutoPwrONdata(void)
{

	MYTIME currTime;
	MYTIME incTime;
	MYTIME ResultTime;
	DTGetRTCTime(&currTime);
	memset(&incTime, 0, sizeof(incTime));
	incTime.nMin= 1;
	incTime.nSec= 20;
	ResultTime = IncrementTime(currTime,incTime);
		/* fill the SPOFList structure depending on the selected values */
		g_spof_cntx.SPOFList[0].Status = SPOF_ENABLE;
		g_spof_cntx.SPOFList[0].Type = SPOF_POWERON;
		g_spof_cntx.SPOFList[0].Hour = ResultTime.nHour;
		g_spof_cntx.SPOFList[0].Min = ResultTime.nMin;

		/*save the alarm in the nvram*/
		SpofWritetoNvram();

		AlmCancelAlarm((U8)(ALM_SPOF_START));
		AlmSetAlarm((U8)(ALM_SPON_START));


}
void TestTimeFunctions()
{
   int iHour = 10;
   int iMinute = 20;
   int iSecond = 30;
   IncrementTime(iHour, iMinute, iSecond, 20);
   assert(iHour == 10);
   assert(iMinute == 20);
   assert(iSecond == 50);
   IncrementTime(iHour, iMinute, iSecond, 20);
   assert(iHour == 10);
   assert(iMinute == 21);
   assert(iSecond == 10);
   IncrementTime(iHour, iMinute, iSecond, 3600);
   assert(iHour == 11);
   assert(iMinute == 21);
   assert(iSecond == 10);
}
Exemple #3
0
//*****************************************************************************
//
// Interrupt handlers
//
//*****************************************************************************
void
SysTickIntHandler(void){
	// Handle incrementing the proper digits
	t++;
	if (t==60){
		IncrementTime();
		t = 0;
	}
}
bool IsWithinTimePeriod(int iHour, int iMinute, int iSecond, int iTimePeriodInSeconds)
{
   for (int iIncrement = 0; iIncrement <= iTimePeriodInSeconds; iIncrement++)
   {
      int iTestHour = iHour;
      int iTestMinute = iMinute;
      int iTestSecond = iSecond;
      IncrementTime(iTestHour, iTestMinute, iTestSecond, iIncrement);
      if (iTestHour == GetCurrentHour() && iTestMinute == GetCurrentMinute() && iTestSecond == GetCurrentSecond())
         return true;
   }

   return false;
}
Exemple #5
0
void LOGO::run()
{
	//string settings.GetDataDir() = DATA_DIR;
	AddLogo(settings.GetFullDataPath("textures/" + settings.GetTexSize() + "/gui/logo_opengl.png"));
	//AddLogo(settings.GetDataDir() + "/tex/splash.jpg");
	AddLogo(settings.GetFullDataPath("textures/" + settings.GetTexSize() + "/gui/splash.png"));
	//AddLogo(settings.GetDataDir() + "/tex/logo_openal.png");
	
	//GLint t = SDL_GetTicks();
	float fps = 100.0;
	GLint T0 = SDL_GetTicks();
	
	bool lp = true;
	
	while (lp)
	{
		//glClearColor(1,1,1,0);
		//glClearColor(0,0,0,0);
		Draw();
		SDL_GL_SwapBuffers( );
		//glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
		
		//t = SDL_GetTicks();
		//fps = 1000000.0/(t - ot);
		//cout << fps << endl;

		GLint t = SDL_GetTicks();
		GLfloat seconds = (t - T0) / 1000.0;
		fps = 1.0 / seconds;
		T0 = t;
		
		t = T0;
		lp = IncrementTime(fps);
		//cout << lp << endl;
		
		SDL_Event event;
		while ( SDL_PollEvent( &event ) )
		{
		    switch( event.type )
			{
				case SDL_KEYDOWN:
					lp = false;
					break;
			}
		}
	}
}
Exemple #6
0
static void DisplayIncrementedTime(void){
	// Method for incrementing the time by 1 minute and then displaying it
	IncrementTime();
	DisplayTime();
}