/elec/propeller-clock

To get this branch, use:
bzr branch http://bzr.ed.am/elec/propeller-clock

« back to all changes in this revision

Viewing changes to src/time.h

  • Committer: Tim Marston
  • Date: 2012-03-09 23:42:20 UTC
  • Revision ID: tim@ed.am-20120309234220-xr1vxzve0o5n2oss
added support for eclipse project and converted to a manual Makefile

Show diffs side-by-side

added added

removed removed

24
24
#define _TIME_H_
25
25
 
26
26
 
27
 
namespace Time
 
27
class Time
28
28
{
29
 
        /**
30
 
         * Initialise time from store.
31
 
         */
32
 
        void load_time();
 
29
public:
33
30
 
34
31
        /**
35
 
         * Save the time to the store.
 
32
         * Get singleton instance.
 
33
         *
 
34
         * @return instance
36
35
         */
37
 
        void save_time();
 
36
        static Time &get_instance();
38
37
 
39
38
        /**
40
39
         * Get year.
98
97
         */
99
98
        void update();
100
99
 
101
 
        /**
102
 
         * Increment the hours and save the time.
103
 
         */
104
 
        void inc_hours();
105
 
 
106
 
        /**
107
 
         * Increment the minutes and save the time.
108
 
         */
109
 
        void inc_minutes();
110
 
 
111
 
        /**
112
 
         * Reset the seconds and save the time.
113
 
         */
114
 
        void reset_seconds();
115
 
 
116
 
        /**
117
 
         * Increment the year and save the time.
118
 
         */
119
 
        void inc_year();
120
 
 
121
 
        /**
122
 
         * Increment the month and save the time.
123
 
         */
124
 
        void inc_month();
125
 
 
126
 
        /**
127
 
         * Increment the day and save the time.
128
 
         */
129
 
        void inc_day();
 
100
protected:
 
101
 
 
102
        Time();
 
103
 
 
104
        /** year */
 
105
        int _year;
 
106
 
 
107
        /** month */
 
108
        int _month;
 
109
 
 
110
        /** day */
 
111
        int _day;
 
112
 
 
113
        /** hours */
 
114
        int _hours;
 
115
 
 
116
        /** minutes */
 
117
        int _minutes;
 
118
 
 
119
        /** seconds */
 
120
        int _seconds;
 
121
 
 
122
private:
 
123
 
 
124
        /** probe the real-time clock device */
 
125
        void probe_rtc();
 
126
 
 
127
        /** milliseconds at last update */
 
128
        unsigned long _last_millis;
 
129
 
 
130
        /** milliseconds carries over from last update */
 
131
        unsigned long _carry;
130
132
 
131
133
};
132
134
 
133
135
 
134
 
#endif //_TIME_H_
 
136
#endif _TIME_H_