Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions Time.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

Expand Down
1 change: 1 addition & 0 deletions TimeLib.h
Original file line number Diff line number Diff line change
Expand Up @@ -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++"
Expand Down