Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: 4DGL-uLCD-SE EthernetInterface NTPClient mbed-rtos mbed SDFileSystem wavfile
Clock.h@0:4e6ae21cbd31, 2014-12-02 (annotated)
- Committer:
- dudanian
- Date:
- Tue Dec 02 17:22:43 2014 +0000
- Revision:
- 0:4e6ae21cbd31
- Child:
- 2:c939d0501184
initial draft
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| dudanian | 0:4e6ae21cbd31 | 1 | #include "mbed.h" |
| dudanian | 0:4e6ae21cbd31 | 2 | #include "NTPClient.h" |
| dudanian | 0:4e6ae21cbd31 | 3 | |
| dudanian | 0:4e6ae21cbd31 | 4 | // AM/PM |
| dudanian | 0:4e6ae21cbd31 | 5 | const int AM = 0; |
| dudanian | 0:4e6ae21cbd31 | 6 | const int PM = 12; |
| dudanian | 0:4e6ae21cbd31 | 7 | |
| dudanian | 0:4e6ae21cbd31 | 8 | // Timezones |
| dudanian | 0:4e6ae21cbd31 | 9 | const int PST = -8; |
| dudanian | 0:4e6ae21cbd31 | 10 | const int MST = -7; |
| dudanian | 0:4e6ae21cbd31 | 11 | const int CST = -6; |
| dudanian | 0:4e6ae21cbd31 | 12 | const int EST = -5; |
| dudanian | 0:4e6ae21cbd31 | 13 | const int UTC = 0; |
| dudanian | 0:4e6ae21cbd31 | 14 | |
| dudanian | 0:4e6ae21cbd31 | 15 | class Clock { |
| dudanian | 0:4e6ae21cbd31 | 16 | public: |
| dudanian | 0:4e6ae21cbd31 | 17 | Clock(); |
| dudanian | 0:4e6ae21cbd31 | 18 | |
| dudanian | 0:4e6ae21cbd31 | 19 | void setTime(int hour, int minute, int period); |
| dudanian | 0:4e6ae21cbd31 | 20 | void setTimezone(int timezone); |
| dudanian | 0:4e6ae21cbd31 | 21 | |
| dudanian | 0:4e6ae21cbd31 | 22 | int syncTime(); |
| dudanian | 0:4e6ae21cbd31 | 23 | |
| dudanian | 0:4e6ae21cbd31 | 24 | time_t getTime(); |
| dudanian | 0:4e6ae21cbd31 | 25 | int getTimezone(); |
| dudanian | 0:4e6ae21cbd31 | 26 | private: |
| dudanian | 0:4e6ae21cbd31 | 27 | int timezone; |
| dudanian | 0:4e6ae21cbd31 | 28 | |
| dudanian | 0:4e6ae21cbd31 | 29 | static bool isSet; |
| dudanian | 0:4e6ae21cbd31 | 30 | }; |