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: mbed SDFileSystem
Diff: include/TimeManager.h
- Revision:
- 2:a694440145e9
diff -r 71c9c97c9f3d -r a694440145e9 include/TimeManager.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/include/TimeManager.h Tue Apr 23 08:47:11 2019 +0000
@@ -0,0 +1,42 @@
+#ifndef _TIMEMANAGER_H_
+#define _TIMEMANAGER_H_
+
+#include "mbed.h"
+#include "string.h"
+
+class TimeManager
+{
+public:
+ /** Opcode for setCurrentTime(YY/MM/DD-HH/mm/SS) */
+ class SetTimeMethod {
+ public:
+ const static int Year = 0;
+ const static int Month = 1;
+ const static int Day = 2;
+ const static int Hour = 3;
+ const static int Min = 4;
+ const static int Sec = 5;
+ };
+ static const int TimeStampLength = sizeof("YYYY-MM-DD_HH:MM:SS") - 1;
+private:
+ /* Tick base class */
+ Ticker baseclock;
+ /* current time */
+ struct tm current;
+public:
+ /* Constractor */
+ TimeManager(void);
+ /* tick (currenttime++) */
+ void tick(void);
+ /* copy Struct Time to arg */
+ void getCurrentTime(struct tm *ret);
+ /* get string of timestamp */
+ int getTimeStamp(char *dst);
+ /* set time parameters */
+ bool setCurrentTime(int selector, int set);
+private:
+ /* calcurate Number of Days in month */
+ int getDaysInMonth(int month, int year);
+};
+
+#endif /* _TIMEMANAGER_H_ */
\ No newline at end of file