13 void Clock::set_rate(float s)
18 void Clock::set_current_time(const Time::TimeDelta &t)
21 signal_discontinuity.emit();
24 void Clock::stop(bool s)
29 void Clock::tick(const Time::TimeDelta &dt)
34 unsigned prev_minute = current_time/Time::min;
35 current_time += dt*rate;
36 if(current_time>=Time::day)
37 current_time -= Time::day;
38 unsigned minute = current_time/Time::min;
39 if(minute!=prev_minute)
43 void Clock::save(list<DataFile::Statement> &st) const
45 st.push_back((DataFile::Statement("rate"), rate));
46 st.push_back((DataFile::Statement("time"), current_time.raw()));
50 Clock::Loader::Loader(Clock &c):
51 DataFile::ObjectLoader<Clock>(c)
53 add("rate", &Clock::rate);
54 add("time", &Loader::time);
57 void Clock::Loader::time(Time::RawTime t)
59 obj.set_current_time(Time::TimeDelta(t));