first version of cron, does not read configuation from file

This commit is contained in:
Emanuele Trabattoni
2025-07-26 16:05:03 +02:00
parent 91f4c5c750
commit 448e1bad15
8 changed files with 1129 additions and 9 deletions

View File

@@ -180,6 +180,12 @@ namespace drivers
const std::string PCF85063::datetime2str(const datetime_t &datetime)
{
tm dtime = datetime2tm(datetime);
const std::string buf(std::asctime(&dtime));
return buf.substr(0, std::min(buf.find('\n'),buf.find('\r')));
}
const std::tm PCF85063::datetime2tm(const datetime_t& datetime) {
tm dtime;
dtime.tm_sec = datetime.second;
dtime.tm_min = datetime.minute;
@@ -188,8 +194,7 @@ namespace drivers
dtime.tm_mday = datetime.day;
dtime.tm_mon = datetime.month - 1;
dtime.tm_year = datetime.year - 1900; // time offset in structure according cpp reference
const std::string buf(std::asctime(&dtime));
return buf.substr(0, std::min(buf.find('\n'),buf.find('\r')));
return dtime;
}
const uint8_t PCF85063::decToBcd(const int val)

View File

@@ -68,8 +68,6 @@ namespace drivers
class PCF85063
{
I2C &m_i2c;
uint8_t m_address;
public:
typedef struct
@@ -102,13 +100,18 @@ namespace drivers
const bool getAlarmFlag(uint8_t &flags);
const std::string getTimeStr();
static const std::string datetime2str(const datetime_t &datetime);
static const std::string datetime2str(const datetime_t &datetime);
static const std::tm datetime2tm(const datetime_t& datetime);
static const PCF85063::datetime_t fromEpoch(const time_t currentTime);
private:
const uint8_t decToBcd(const int val);
const int bcdToDec(const uint8_t val);
private:
I2C &m_i2c;
uint8_t m_address;
};
}