Skip to content

Commit a51b2d5

Browse files
committed
Add function to set internal time
1 parent 7cd0f63 commit a51b2d5

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/utility/time/TimeService.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,11 @@ unsigned long TimeService::getTime()
140140
return isTimeValid(utc) ? utc : EPOCH_AT_COMPILE_TIME;
141141
}
142142

143+
void TimeService::setTime(unsigned long time)
144+
{
145+
setRTC(time);
146+
}
147+
143148
#ifdef HAS_TCP
144149
bool TimeService::sync()
145150
{

src/utility/time/TimeService.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ class TimeService
3838

3939
void begin (ConnectionHandler * con_hdl);
4040
unsigned long getTime();
41+
void setTime(unsigned long time);
4142
unsigned long getLocalTime();
4243
void setTimeZoneData(long offset, unsigned long valid_until);
4344
#ifdef HAS_TCP

0 commit comments

Comments
 (0)