BriComp
Well-known member
Below is some simple code using the time library.
Unfortunately the breakTime function returns 54 as the year rather than 24.
Unfortunately the breakTime function returns 54 as the year rather than 24.
Code:
void setup() {
tmElements_t t;
time_t ut;
uint8_t h, m, s, d, mo, y;
h = 12;
m = 45;
s = 0;
d = 4;
mo = 9;
y = 2024;
Serial.begin(9600);
while (!Serial and millis() < 5000);
setTime(h,m,s,d,mo,y);
ut = now();
Serial.println(ut);
breakTime(ut,t);// 1725448362 + 3600, t); // break time_t into elements
Serial.print(t.Hour); Serial.print(":");
Serial.print(t.Minute); Serial.print(":");
Serial.print(t.Second); Serial.print(" ");
Serial.print(t.Wday); Serial.print(" ");
Serial.print(t.Day); Serial.print("/");
Serial.print(t.Month); Serial.print("/");
Serial.print(t.Year);
};
void loop() {
};