3rd Repo, trying to figure this out.

Dependencies:   LPS25H hts221

Fork of SOFT253_Template_Weather_OS_54 by Stage-1 Students SoCEM

LocalDate.cpp

Committer:
FairyMental
Date:
2017-04-06
Revision:
46:0de1f3c7d118
Child:
47:468a89d62c23

File content as of revision 46:0de1f3c7d118:

#include "LocalDate.h"
#include <stdio.h>
    LocalDate::LocalDate(int d, int m, int y,int h,int mm,int s)
    {
        day = d;
        month = m;
        year = y;   
        hour = h;
        min = mm;
        sec = s;
    }
    LocalDate::LocalDate()
    {
        day = 12;
        month = 12;
        year = 2012;   
        hour = 12;
        min = 12;
        sec = 12;
    }
    char* LocalDate::ToString()
    {
        char *charArray = new char[40];
        sprintf(charArray,"%i/%i/%i - %i:%i:%i \r\n",day,month,year,hour,min,sec);
        return charArray;
    }
    
    
    void LocalDate::TickSecond()
    {
        sec++;
        if(sec == 60)
        {
            sec=0;
            min++;   
            if(min==60)
            {
                min = 0;
                hour++;
                if(hour ==24)
                {
                    hour = 0;
                    day++;
                    if(day ==31)
                    {
                        day = 0;
                        month++;
                        if(month==13)   
                        {
                            month = 1;
                            year++;   
                        }
                    }
                }
            }
        }
        
    }