/****************************************************************************
 Title	:	TERMINAL FOR VISUALIZATION AND CONTROL CONDITIONS IN HOUSE
 Author	:	Patrik Szalay <xszala01@stud.feec.vutbr.cz>
 File	:	clock.c
 Software:	CodeWarrior Development Studio Version: 10.6 Build Id:140329
 Target	:	MC9S08LH64

 DESCRIPTION
       Code for the the variable clock_now

 USAGE
       
*****************************************************************************/

#include "clock.h"

time clock_now;


void clockSetSeconds(unsigned char seconds)
{
	clock_now.seconds = seconds;
}
void clockSetMinutes(unsigned char minutes)
{
	clock_now.minutes = minutes;
}
void clockSetHours(unsigned char hours)
{
	clock_now.hours = hours;
}
void clockSetDay(unsigned char day)
{
	clock_now.day = day;
}
void clockSetDayOfWeek(unsigned char dayOfWeek)
{
	clock_now.dayOfWeek = dayOfWeek;
}
void clockSetMonth(unsigned char month)
{
	clock_now.month = month;
}
void clockSetYear(unsigned int year)
{
	clock_now.year = year;
}

void clockSetRTC(void)
{
	setRTC(clock_now);
}

void clockSet(time now)
{
	clock_now = now;
	setRTC(clock_now);
}

void clockRefreshFromRTC(void)
{
	clock_now = readRTC();
}
