13 void Clock::set_rate(float s)
18 void Clock::set_current_time(const Time::TimeDelta &t)
23 void Clock::stop(bool s)
28 void Clock::tick(const Time::TimeDelta &dt)
33 unsigned prev_minute = current_time/Time::min;
34 current_time += dt*rate;
35 if(current_time>=Time::day)
36 current_time -= Time::day;
37 unsigned minute = current_time/Time::min;
38 if(minute!=prev_minute)
42 void Clock::save(list<DataFile::Statement> &st) const
44 st.push_back((DataFile::Statement("rate"), rate));
45 st.push_back((DataFile::Statement("time"), current_time.raw()));
49 Clock::Loader::Loader(Clock &c):
50 DataFile::ObjectLoader<Clock>(c)
52 add("rate", &Clock::rate);
53 add("time", &Loader::time);
56 void Clock::Loader::time(Time::RawTime t)
58 obj.set_current_time(Time::TimeDelta(t));