Skip to content

Commit

Permalink
Replaced deprecated functions
Browse files Browse the repository at this point in the history
  • Loading branch information
simonmicro committed Sep 23, 2023
1 parent d45f537 commit 814d721
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion emulator/include/RtcDS3231.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class RtcDateTime {
RtcDateTime() {};
virtual ~RtcDateTime() {};

void InitWithEpoch32Time(time_t time);
void InitWithUnix32Time(time_t time);

uint32_t Hour();
uint32_t Minute();
Expand Down
2 changes: 1 addition & 1 deletion emulator/src/RtcDS3231.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "../include/RtcDS3231.h"

void RtcDateTime::InitWithEpoch32Time(time_t time) {
void RtcDateTime::InitWithUnix32Time(time_t time) {
this->time = time;
}

Expand Down
8 changes: 4 additions & 4 deletions src/devices/ds3231mz.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ void OswDevices::DS3231MZ::setup() {
}

void OswDevices::DS3231MZ::update() {
uint32_t temp = Rtc.GetDateTime().Epoch32Time();
uint32_t temp = Rtc.GetDateTime().Unix32Time();
if (!Rtc.LastError()) {
// success on first attempt
_utcTime = temp;
Expand All @@ -45,7 +45,7 @@ void OswDevices::DS3231MZ::update() {
// try harder
uint8_t tries = 10;
while (_utcTime == 0 && tries > 0) {
temp = Rtc.GetDateTime().Epoch32Time();
temp = Rtc.GetDateTime().Unix32Time();
if (!Rtc.LastError()) {
// success on n-th attempt
_utcTime = temp;
Expand All @@ -55,7 +55,7 @@ void OswDevices::DS3231MZ::update() {
}

// fail, assume compile time as closest time in the past
_utcTime = RtcDateTime(__DATE__, __TIME__).Epoch32Time();
_utcTime = RtcDateTime(__DATE__, __TIME__).Unix32Time();
}

time_t OswDevices::DS3231MZ::getUTCTime() {
Expand All @@ -65,7 +65,7 @@ time_t OswDevices::DS3231MZ::getUTCTime() {

void OswDevices::DS3231MZ::setUTCTime(const time_t& epoch) {
RtcDateTime t = RtcDateTime();
t.InitWithEpoch32Time(epoch);
t.InitWithUnix32Time(epoch);
Rtc.SetDateTime(t);
}

Expand Down

0 comments on commit 814d721

Please sign in to comment.