3rd Repo, trying to figure this out.

Dependencies:   LPS25H hts221

Fork of SOFT253_Template_Weather_OS_54 by Stage-1 Students SoCEM

Committer:
Netaphous
Date:
Mon Apr 10 01:37:12 2017 +0000
Revision:
67:8d0e88172e2a
Parent:
47:468a89d62c23
Child:
68:d3765f93c16a
Fixed an issue with taking measurements of the current time causing an out of memory error

Who changed what in which revision?

UserRevisionLine numberNew contents of line
FairyMental 46:0de1f3c7d118 1 #include "LocalDate.h"
FairyMental 46:0de1f3c7d118 2 #include <stdio.h>
FairyMental 46:0de1f3c7d118 3 LocalDate::LocalDate(int d, int m, int y,int h,int mm,int s)
FairyMental 46:0de1f3c7d118 4 {
FairyMental 46:0de1f3c7d118 5 day = d;
FairyMental 46:0de1f3c7d118 6 month = m;
FairyMental 46:0de1f3c7d118 7 year = y;
FairyMental 46:0de1f3c7d118 8 hour = h;
FairyMental 46:0de1f3c7d118 9 min = mm;
FairyMental 46:0de1f3c7d118 10 sec = s;
FairyMental 46:0de1f3c7d118 11 }
FairyMental 46:0de1f3c7d118 12 LocalDate::LocalDate()
FairyMental 46:0de1f3c7d118 13 {
FairyMental 46:0de1f3c7d118 14 day = 12;
FairyMental 46:0de1f3c7d118 15 month = 12;
FairyMental 46:0de1f3c7d118 16 year = 2012;
FairyMental 46:0de1f3c7d118 17 hour = 12;
FairyMental 46:0de1f3c7d118 18 min = 12;
FairyMental 46:0de1f3c7d118 19 sec = 12;
FairyMental 46:0de1f3c7d118 20 }
FairyMental 47:468a89d62c23 21 LocalDate::LocalDate(LocalDate *localDate)
FairyMental 47:468a89d62c23 22 {
FairyMental 47:468a89d62c23 23 day = localDate->day;
FairyMental 47:468a89d62c23 24 month = localDate->month;
FairyMental 47:468a89d62c23 25 year = localDate->year;
FairyMental 47:468a89d62c23 26 hour = localDate->hour;
FairyMental 47:468a89d62c23 27 min = localDate->min;
FairyMental 47:468a89d62c23 28 sec = localDate->sec;
FairyMental 47:468a89d62c23 29 }
Netaphous 67:8d0e88172e2a 30 void LocalDate::setValues(LocalDate *localDate)
Netaphous 67:8d0e88172e2a 31 {
Netaphous 67:8d0e88172e2a 32 day = localDate->day;
Netaphous 67:8d0e88172e2a 33 month = localDate->month;
Netaphous 67:8d0e88172e2a 34 year = localDate->year;
Netaphous 67:8d0e88172e2a 35 hour = localDate->hour;
Netaphous 67:8d0e88172e2a 36 min = localDate->min;
Netaphous 67:8d0e88172e2a 37 sec = localDate->sec;
Netaphous 67:8d0e88172e2a 38 }
FairyMental 46:0de1f3c7d118 39 char* LocalDate::ToString()
FairyMental 46:0de1f3c7d118 40 {
FairyMental 46:0de1f3c7d118 41 char *charArray = new char[40];
FairyMental 47:468a89d62c23 42 sprintf(charArray,"%i/%i/%i - %i:%i:%i",day,month,year,hour,min,sec);
FairyMental 46:0de1f3c7d118 43 return charArray;
FairyMental 46:0de1f3c7d118 44 }
FairyMental 46:0de1f3c7d118 45
FairyMental 46:0de1f3c7d118 46
FairyMental 46:0de1f3c7d118 47 void LocalDate::TickSecond()
FairyMental 46:0de1f3c7d118 48 {
FairyMental 46:0de1f3c7d118 49 sec++;
FairyMental 46:0de1f3c7d118 50 if(sec == 60)
FairyMental 46:0de1f3c7d118 51 {
FairyMental 46:0de1f3c7d118 52 sec=0;
FairyMental 46:0de1f3c7d118 53 min++;
FairyMental 46:0de1f3c7d118 54 if(min==60)
FairyMental 46:0de1f3c7d118 55 {
FairyMental 46:0de1f3c7d118 56 min = 0;
FairyMental 46:0de1f3c7d118 57 hour++;
FairyMental 46:0de1f3c7d118 58 if(hour ==24)
FairyMental 46:0de1f3c7d118 59 {
FairyMental 46:0de1f3c7d118 60 hour = 0;
FairyMental 46:0de1f3c7d118 61 day++;
FairyMental 46:0de1f3c7d118 62 if(day ==31)
FairyMental 46:0de1f3c7d118 63 {
FairyMental 46:0de1f3c7d118 64 day = 0;
FairyMental 46:0de1f3c7d118 65 month++;
FairyMental 46:0de1f3c7d118 66 if(month==13)
FairyMental 46:0de1f3c7d118 67 {
FairyMental 46:0de1f3c7d118 68 month = 1;
FairyMental 46:0de1f3c7d118 69 year++;
FairyMental 46:0de1f3c7d118 70 }
FairyMental 46:0de1f3c7d118 71 }
FairyMental 46:0de1f3c7d118 72 }
FairyMental 46:0de1f3c7d118 73 }
FairyMental 46:0de1f3c7d118 74 }
FairyMental 46:0de1f3c7d118 75
FairyMental 46:0de1f3c7d118 76 }