



package service;

import java.util.Calendar;
import xmltypes.*;
import org.cybergarage.upnp.Service;
import org.cybergarage.upnp.StateVariable;

public class ComputerTimer implements Timer {
    private Service service;
    private StateVariable timeVar;
    private StateVariable validVar;

    public void setTime(Time t) {
	// void
    }

    public Time getTime() {
	Calendar now = Calendar.getInstance();
	Time time = new Time(now.get(Calendar.HOUR_OF_DAY),
			now.get(Calendar.MINUTE),
			now.get(Calendar.SECOND));
	timeVar.setValue(time.toString());

	return time;
    }

    public boolean isValidTime() {
	return true;
    }

    public void setService(Service svc) {
	this.service = svc;

	timeVar = svc.getStateVariable("Time");

	validVar = svc.getStateVariable("TimeValid");
	validVar.setValue("true");
    }
}
