Andrew Boyson / clock

Dependents:   oldheating gps motorhome heating

Revision:
44:aa45226d118e
Parent:
38:25b2a3c494aa
Child:
57:4daf2e423b27
--- a/tm/tm.c	Wed Dec 05 11:35:16 2018 +0000
+++ b/tm/tm.c	Sat Dec 29 19:00:39 2018 +0000
@@ -279,6 +279,16 @@
     //Fill the day of week and the day of year part of the tm structure
     calculateDayOfYearAndWeek(ptm->tm_year, ptm->tm_mon, ptm->tm_mday, &ptm->tm_yday, &ptm->tm_wday);
 }
+void TmFromInteger(int year, int month, int mday, int hour, int min, int sec, struct tm* ptm)
+{
+    ptm->tm_year = year - 1900;
+    ptm->tm_mon = month - 1;
+    ptm->tm_mday = mday;
+    calculateDayOfYearAndWeek(ptm->tm_year, ptm->tm_mon, ptm->tm_mday, &ptm->tm_yday, &ptm->tm_wday);
+    ptm->tm_hour = hour;
+    ptm->tm_min  = min;
+    ptm->tm_sec  = sec;
+}
 void TmIncrement(struct tm* ptm)
 {
     ptm->tm_sec++;