fuck this
Dependencies: BMP280
TimeInterface.h@25:a2aedb498b27, 2018-01-10 (annotated)
- Committer:
- mwthewsey
- Date:
- Wed Jan 10 03:57:59 2018 +0000
- Revision:
- 25:a2aedb498b27
- Parent:
- 11:b538e73841ae
Final Submission
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mwthewsey | 10:261f2b69c4c7 | 1 | #include "mbed.h" |
mwthewsey | 10:261f2b69c4c7 | 2 | /* |
mwthewsey | 10:261f2b69c4c7 | 3 | * These functions provide an easy way to set and read the onboard time of day clock. |
mwthewsey | 10:261f2b69c4c7 | 4 | * At start, the clock will read 1970 and so needs to be set for meaningful values. |
mwthewsey | 10:261f2b69c4c7 | 5 | * Time is returned in a tm data strucure. Variables held in the structure are |
mwthewsey | 10:261f2b69c4c7 | 6 | * listed at the bottom of the header file. |
mwthewsey | 10:261f2b69c4c7 | 7 | */ |
mwthewsey | 10:261f2b69c4c7 | 8 | void SetDate(int DD, int MM, int YYYY); |
mwthewsey | 10:261f2b69c4c7 | 9 | //Sets the given date as system date. Does not modify time. |
mwthewsey | 10:261f2b69c4c7 | 10 | |
mwthewsey | 10:261f2b69c4c7 | 11 | void SetTime(int HH, int mm, int ss); |
mwthewsey | 10:261f2b69c4c7 | 12 | |
mwthewsey | 10:261f2b69c4c7 | 13 | struct tm ReturnDateTimeStruct(time_t seconds); |
mwthewsey | 10:261f2b69c4c7 | 14 | //Returns a time structure from the integer time given. |
mwthewsey | 10:261f2b69c4c7 | 15 | //Passing in time(0) will pass in the current system time. |
mwthewsey | 10:261f2b69c4c7 | 16 | |
mwthewsey | 10:261f2b69c4c7 | 17 | /* tm structure: |
mwthewsey | 10:261f2b69c4c7 | 18 | *struct tm { |
mwthewsey | 10:261f2b69c4c7 | 19 | * int tm_sec; // seconds of minutes from 0 to 61 |
mwthewsey | 10:261f2b69c4c7 | 20 | * int tm_min; // minutes of hour from 0 to 59 |
mwthewsey | 10:261f2b69c4c7 | 21 | * int tm_hour; // hours of day from 0 to 24 |
mwthewsey | 10:261f2b69c4c7 | 22 | * int tm_mday; // day of month from 1 to 31 |
mwthewsey | 10:261f2b69c4c7 | 23 | * int tm_mon; // month of year from 1 to 12 (customised) |
mwthewsey | 11:b538e73841ae | 24 | * int tm_year; // year since 1900 (customised)gives acctual year |
mwthewsey | 10:261f2b69c4c7 | 25 | * int tm_wday; // days since sunday |
mwthewsey | 10:261f2b69c4c7 | 26 | * int tm_yday; // days since January 1st |
mwthewsey | 10:261f2b69c4c7 | 27 | * int tm_isdst; // hours of daylight savings time |
mwthewsey | 10:261f2b69c4c7 | 28 | *} |
mwthewsey | 10:261f2b69c4c7 | 29 | tm T = ReturnDateTimeStruct(3456784567); |
mwthewsey | 10:261f2b69c4c7 | 30 | T.tm_hour; |
mwthewsey | 10:261f2b69c4c7 | 31 | |
mwthewsey | 10:261f2b69c4c7 | 32 | */ |