/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: 2013-03-31 17:07:36 UTC
  • Revision ID: tim@ed.am-20130331170736-hphm2hg0y6l7w6z1
made rtc-test's DS1307 library a symlink to the main one in src/util

Show diffs side-by-side

added added

removed removed

 
1
/*
 
2
 * time.h
 
3
 *
 
4
 * Copyright (C) 2011 Tim Marston <tim@ed.am> and Dan Marston.
 
5
 *
 
6
 * This file is part of propeller-clock (hereafter referred to as "this
 
7
 * program"). See http://ed.am/dev/software/arduino/propeller-clock for more
 
8
 * information.
 
9
 *
 
10
 * This program is free software: you can redistribute it and/or modify
 
11
 * it under the terms of the GNU Lesser General Public License as published
 
12
 * by the Free Software Foundation, either version 3 of the License, or
 
13
 * (at your option) any later version.
 
14
 *
 
15
 * This program is distributed in the hope that it will be useful,
 
16
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
17
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
18
 * GNU Lesser General Public License for more details.
 
19
 *
 
20
 * You should have received a copy of the GNU Lesser General Public License
 
21
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
22
 */
 
23
#ifndef _TIME_H_
 
24
#define _TIME_H_
 
25
 
 
26
 
 
27
namespace Time
 
28
{
 
29
        /**
 
30
         * Initialise time from store.
 
31
         */
 
32
        void load_time();
 
33
 
 
34
        /**
 
35
         * Save the time to the store.
 
36
         */
 
37
        void save_time();
 
38
 
 
39
        /**
 
40
         * Get year.
 
41
         *
 
42
         * @return year
 
43
         */
 
44
        int get_year();
 
45
 
 
46
        /**
 
47
         * Get month.
 
48
         *
 
49
         * @return month, 1 to 12
 
50
         */
 
51
        int get_month();
 
52
 
 
53
        /**
 
54
         * Get month name.
 
55
         *
 
56
         * @return month name
 
57
         */
 
58
        const char *get_month_name();
 
59
 
 
60
        /**
 
61
         * Get day.
 
62
         *
 
63
         * @return date, 1 to 31
 
64
         */
 
65
        int get_day();
 
66
 
 
67
        /**
 
68
         * Get number suffix.
 
69
         *
 
70
         * @param number
 
71
         * @return suffix
 
72
         */
 
73
        const char *get_day_suffix();
 
74
 
 
75
        /**
 
76
         * Get hours.
 
77
         *
 
78
         * @return hours, 0 to 23
 
79
         */
 
80
        int get_hours();
 
81
 
 
82
        /**
 
83
         * Get minutes.
 
84
         *
 
85
         * @return minutes, 0 to 59
 
86
         */
 
87
        int get_minutes();
 
88
 
 
89
        /**
 
90
         * Get seconds.
 
91
         *
 
92
         * @return seconds, 0 to 59
 
93
         */
 
94
        int get_seconds();
 
95
 
 
96
        /**
 
97
         * Update the time.
 
98
         */
 
99
        void update();
 
100
 
 
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();
 
130
 
 
131
};
 
132
 
 
133
 
 
134
#endif //_TIME_H_