/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: edam
  • Date: 2012-02-25 01:31:17 UTC
  • Revision ID: tim@ed.am-20120225013117-53ed8yahoreoms76
updated software to include drawing abstraction infrastructure

Show diffs side-by-side

added added

removed removed

 
1
class Time
 
2
{
 
3
public:
 
4
 
 
5
        /**
 
6
         * Get singleton instance.
 
7
         *
 
8
         * @return instance
 
9
         */
 
10
        static Time &get_instance();
 
11
 
 
12
        /**
 
13
         * Get hours.
 
14
         *
 
15
         * @return hours, 0 to 23
 
16
         */
 
17
        int get_hours();
 
18
 
 
19
        /**
 
20
         * Get minutes.
 
21
         *
 
22
         * @return minutes, 0 to 59
 
23
         */
 
24
        int get_minutes();
 
25
 
 
26
        /**
 
27
         * Get seconds.
 
28
         *
 
29
         * @return seconds, 0 to 59
 
30
         */
 
31
        int get_seconds();
 
32
 
 
33
        /**
 
34
         * Update the time.
 
35
         */
 
36
        void update();
 
37
 
 
38
protected:
 
39
 
 
40
        Time();
 
41
 
 
42
        /** hours */
 
43
        int _hours;
 
44
 
 
45
        /** minutes */
 
46
        int _minutes;
 
47
 
 
48
        /** seconds */
 
49
        int _seconds;
 
50
 
 
51
private:
 
52
 
 
53
        /** milliseconds at last update */
 
54
        unsigned long _last_millis;
 
55
 
 
56
        /** milliseconds carries over from last update */
 
57
        unsigned long _carry;
 
58
 
 
59
};