Пример #1
0
void CTimeViewer::OnTimer(UINT_PTR nIDEvent)
{
	// TODO: Add your message handler code here and/or call default

	m_sTime ++;
	if(m_sTime == 60)
	{
		m_sTime = 0;
		m_mTime ++;
		if(m_mTime == 60)
		{
			m_hTime ++;
			SetSecond();
			SetHour();
			SetMinute();
		}
		else
		{
			SetMinute();
			SetSecond();
		}
	}
	else
	{
		SetSecond();
	}
	CWnd::OnTimer(nIDEvent);
}
Пример #2
0
void SetCalenderTime(CalenderTime *ct)
{
	SetYear(ct->year);
	SetMonth(ct->month);
	SetDate(ct->date);
	SetHour(ct->hour);
	SetMinute(ct->minute);
	SetSecond(ct->second);
//	RtcDisableWrite();
}
Пример #3
0
 ///////////////////////////////////////////////////////////////////////
 // Function: SetTime
 //
 //   Author: $author$
 //     Date: 6/21/2009
 ///////////////////////////////////////////////////////////////////////
 virtual EvError SetTime
 (const EvTime& time,
  bool is12=false,
  bool isPM=false,
  bool isLocal=false,
  const EvTimezone* timezone=0) 
 {
     EvError error = EV_ERROR_NONE;
     SetHour(time.GetHour(isPM));
     SetMinute(time.GetMinute());
     SetSecond(time.GetSecond());
     SetMillisecond(time.GetMillisecond());
     return error;
 }
Пример #4
0
void CDate_std::SetToTime(const CTime& time, CDate::EPrecision prec)
{
    switch (prec) {
    case CDate::ePrecision_second:
        SetSecond(time.Second());
        SetMinute(time.Minute());
        SetHour  (time.Hour());
        // fall through
    case CDate::ePrecision_day:
        SetDay   (time.Day());
        SetMonth (time.Month());
        SetYear  (time.Year());
        break;
    default:
        break;
    }
}
Пример #5
0
void SettingsSetTimeScreen::loop()
{
    return;
    int x = getTouchX();
    int y = getTouchY();

    // TODO
    if (x>54 && x<88) {
        //-
        if (y>6 && y<27) {
            // month
            uint8_t month = GetMonth();
            uint8_t next_month = month - 1;
            if(month == 0)
                next_month = 12;

            SetMonth(next_month);
            renderMonth();
        }
        if (y>40 && y<61) {
            // day
            uint8_t day = GetDate();
            uint8_t next_day = day - 1;
            if(day == 0)
                next_day = 31;

            SetMonth(next_day);
            renderDay();
        }
        if (y>73 && y<94) {
            // yr
            uint8_t year = GetYear();
            uint8_t next_year = year - 1;
            SetYear(next_year);
            renderYear();
        }
        if (y>106 && y<127) {
            // hr
            uint8_t hour = GetHour();
            uint8_t next_hour = hour - 1;
            SetHour(next_hour);
            renderHour();
        }
        if (y>140 && y<161) {
            // min
            uint8_t minute = GetMinute();
            uint8_t next_minute = minute - 1;
            SetMinute(next_minute);
            renderMinute();
        }
        if (y>173 && y<194) {
            // am/pm
            uint8_t ampm = GetAmPm();
            SetAmPm(~ampm);
        }

    }
    if (x>104 && x<138) {
        //+
        if (y>6 && y<27) {
            // month
        }
        if (y>40 && y<61) {
            // day
        }
        if (y>73 && y<94) {
            // yr
        }
        if (y>106 && y<127) {
            // hr
        }
        if (y>140 && y<161) {
            // min
        }
        if (y>173 && y<194) {
            // am/pm
        }
    }
}
Пример #6
0
// This runs once during program startup
void Controller::setup()
{
	// Setup code here
    LGSerial::init();
    LGSerial::put("Hello World!");

	DDRC |= 1 << DDC2;//trigger
	DDRC |= 1 << DDC3;//pc3 pin 26 for output
	DDRC |= 1 << DDC4;
	DDRC |= 1 << DDC5;
	DDRD |= 1 << DDD0;

	PORTD &= ~(1 << PD0);
	PORTC &= ~(1 << PC2);
	PORTC &= ~(1 << PC3);
	_delay_ms(500);

	ClockInit();


	SetSecond(1);
	SetMinute(33);
	SetHour(8);
	SetAmPm(1);///0 for AM, 1 for PM
	SetDay(3);
	SetDate(23);
	SetMonth(4);
	SetYear(13);

	char Time[12];	//hh:mm:ss AM/PM

	while(0)
	{
		//Get the Current Time as a String
		if(!GetTimeString(Time))//modifies time
		{
			/*
			 If return value is false then some error has occured

			 Check
			 ->DS1307 Installed Properly
			 ->DIP Switch 1,2 are in on position
			 */
			while(1);//halt
		}
		_delay_ms(500);
	}

	uint8_t second = GetSecond();
	uint8_t minute = GetMinute();
	uint8_t hour = GetHour();
	uint8_t AmPm = GetAmPm();
	uint8_t day = GetDate();
	uint8_t date = GetDate();
	uint8_t month = GetMonth();
	uint8_t year = GetYear();


	LGSerial::print(second);
	LGSerial::print(minute);
	LGSerial::print(hour);
	LGSerial::print(AmPm);
	LGSerial::print(day);
	LGSerial::print(date);
	LGSerial::print(month);
	LGSerial::print(year);

	_delay_ms(20000);
	second = GetSecond();
	minute = GetMinute();
	LGSerial::print(second);
	LGSerial::print(minute);

	_delay_ms(20000);
	second = GetSecond();
	minute = GetMinute();
	LGSerial::print(second);
	LGSerial::print(minute);



	//uint8_t minute = GetMinute();
//uint8_t minute = 0xAA;
//	bool min[8];
/*
	min[0] = minute & 0x01;
	min[1] = minute & 0x02;
	min[2] = minute & 0x04;
	min[3] = minute & 0x08;
	min[4] = minute & 0x10;
	min[5] = minute & 0x20;
	min[6] = minute & 0x40;
	min[7] = minute & 0x80;
*/

	/*
	 min[0] = 0;
	 min[1] = 1;
	 min[2] = 0;
	 min[3] = 1;
	 min[4] = 0;
	 min[5] = 1;
	 min[6] = 0;
	 min[7] = 1;
	 */

	/*

	int i = 0;

	while(1){
		//make pc2 trigger
		PORTC |= 1 << PC2;
		PORTC &= ~(1 << PC2);

		PORTC |= 1 << PC3;
		PORTC &= ~(1 << PC3);
		PORTC |= 1 << PC3;
		PORTC &= ~(1 << PC3);
		PORTC |= 1 << PC3;
		PORTC &= ~(1 << PC3);

		for (i=0;i<8;i++){
			if (min[i] == 1){	//if that bit of min is 1
				PORTD |= 1 << PD0;
				PORTD &= ~(1 << PD0);
				PORTD |= 1 << PD0;
				PORTD &= ~(1 << PD0);

				PORTC &= ~(1 << PC3);
				PORTC |= 1 << PC3;
				PORTC &= ~(1 << PC3);


			}
			else {//if (min[i] == 0){	//if that bit of min is 0
				PORTD |= 1 << PD0;
				PORTD &= ~(1 << PD0);

				PORTC |= 1 << PC3;
				PORTC &= ~(1 << PC3);
				PORTC |= 1 << PC3;

			}
		}

	}
	*/
}
Пример #7
0
void CTime::SetTime(int hour, int minute, int second)
{
	SetHour(hour);
	SetMinute(minute);
	SetSecond(second);
}
Пример #8
0
CTime::CTime(int hour, int minute, int second) : m_hour(0), m_minute(0), m_second(0)
{
	SetHour(hour);
	SetMinute(minute);
	SetSecond(second);
}