/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-10 01:25:02 UTC
  • Revision ID: tim@ed.am-20120310012502-v0jwfjghpp63un6n
removed time singleton, not cause it saved much space, but cause i don't want singletons in this project!

Show diffs side-by-side

added added

removed removed

24
24
#define _TIME_H_
25
25
 
26
26
 
27
 
class Time
 
27
namespace Time
28
28
{
29
 
public:
30
 
 
31
 
        /**
32
 
         * Get singleton instance.
33
 
         *
34
 
         * @return instance
35
 
         */
36
 
        static Time &get_instance();
37
 
 
38
29
        /**
39
30
         * Get year.
40
31
         *
97
88
         */
98
89
        void update();
99
90
 
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;
 
91
        /**
 
92
         * Initialise time data
 
93
         */
 
94
        void init();
132
95
 
133
96
};
134
97