/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-28 17:03:09 UTC
  • Revision ID: edam@waxworlds.org-20120228170309-gaaj6k3prrgvwvp8
remove TextRenderer singleton and save space

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
 
         * Get year.
31
 
         *
32
 
         * @return year
33
 
         */
34
 
        int get_year();
35
 
 
36
 
        /**
37
 
         * Get month.
38
 
         *
39
 
         * @return month, 1 to 12
40
 
         */
41
 
        int get_month();
42
 
 
43
 
        /**
44
 
         * Get month name.
45
 
         *
46
 
         * @return month name
47
 
         */
48
 
        const char *get_month_name();
49
 
 
50
 
        /**
51
 
         * Get day.
52
 
         *
53
 
         * @return date, 1 to 31
54
 
         */
55
 
        int get_day();
56
 
 
57
 
        /**
58
 
         * Get number suffix.
59
 
         *
60
 
         * @param number
61
 
         * @return suffix
62
 
         */
63
 
        const char *get_day_suffix();
 
29
public:
 
30
 
 
31
        /**
 
32
         * Get singleton instance.
 
33
         *
 
34
         * @return instance
 
35
         */
 
36
        static Time &get_instance();
64
37
 
65
38
        /**
66
39
         * Get hours.
88
61
         */
89
62
        void update();
90
63
 
91
 
        /**
92
 
         * Initialise time data
93
 
         */
94
 
        void init();
 
64
protected:
 
65
 
 
66
        Time();
 
67
 
 
68
        /** hours */
 
69
        int _hours;
 
70
 
 
71
        /** minutes */
 
72
        int _minutes;
 
73
 
 
74
        /** seconds */
 
75
        int _seconds;
 
76
 
 
77
private:
 
78
 
 
79
        /** milliseconds at last update */
 
80
        unsigned long _last_millis;
 
81
 
 
82
        /** milliseconds carries over from last update */
 
83
        unsigned long _carry;
95
84
 
96
85
};
97
86