The use of the ESP8266 in the world of IoT

User avatar
By BLCKPSTV
#90161 Hi,

I hope I picked the correct subchannel for this question.

I have a project that runs for 2 or 3 weeks.
When the project runs I want an Wemos D1 mini chip to get it's current day of running the code (even when it needs to be rebooted preferably, but this is not necessary).
Until the 2 or 3 weeks have been done.

Later on I want to send the current day to another program via osc.

How do I do this? There are a lot of get_time options but most of them just calculate time in a year. I just niet days of a certain amount of time.
User avatar
By schufti
#90163 in general time() returns unix time=seconds since 1.1.1970
so if you read time() @ start of your operation and subtract it from time() @ any later moment it is just plain arithmetics to calculate d/h/m/s from this difference...

if it dosn't have to be consistent over reboot you can use millis(), it is sufficient for about 50days after reboot.
User avatar
By BLCKPSTV
#90164 Hmmm :? my arithmatics aren't that good I guess...

I'm reading up on the time() and the epochs stuff. But how do I state day one and add days with this.

sorry probably easy but not seeing it atm..
User avatar
By BLCKPSTV
#90165
BLCKPSTV wrote:Hmmm :? my arithmatics aren't that good I guess...

I'm reading up on the time() and the epochs stuff. But how do I state day one and add days with this.

sorry probably easy but not seeing it atm..



I'll look in to the millis() first that I understand for the moment :D