/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 13:04:29 UTC
  • Revision ID: tim@ed.am-20120310130429-310w5ejo968mc6mo
cleaned-up notes

Show diffs side-by-side

added added

removed removed

Lines of Context:
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();
 
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();
37
64
 
38
65
        /**
39
66
         * Get hours.
61
88
         */
62
89
        void update();
63
90
 
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;
 
91
        /**
 
92
         * Initialise time data
 
93
         */
 
94
        void init();
84
95
 
85
96
};
86
97