diff --git a/Time.cpp b/Time.cpp index 8e53e56..60038cd 100644 --- a/Time.cpp +++ b/Time.cpp @@ -231,6 +231,26 @@ time_t makeTime(const tmElements_t &tm){ seconds+= tm.Second; return (time_t)seconds; } + +time_t makeTime(int yr, int mnth, int day, int hr, int min, int sec){ + if (yr > 99){ + yr = yr - 1970; + } else { + yr += 30; +} + +tmElements_t ntm; + +ntm.Year = yr; +ntm.Month = mnth; +ntm.Day = day; +ntm.Hour = hr; +ntm.Minute = min; +ntm.Second = sec; +return makeTime(ntm); +} + + /*=====================================================*/ /* Low level system time functions */ diff --git a/TimeLib.h b/TimeLib.h index 20e2445..80d0130 100644 --- a/TimeLib.h +++ b/TimeLib.h @@ -136,6 +136,7 @@ void setSyncInterval(time_t interval); // set the number of seconds between r /* low level functions to convert to and from system time */ void breakTime(time_t time, tmElements_t &tm); // break time_t into elements +time_t makeTime(int hr,int min,int sec,int day, int month, int yr); time_t makeTime(const tmElements_t &tm); // convert time elements into time_t } // extern "C++"