Hello,
I started a new thread derived from this thread finding out which time.h is used for compiling ? - Programming Questions - Arduino Forum
because the title of the other thread leads to different answers. It was asking for certain time.h-files.
Now this thread is somehow related but is asking a different thing. I hope you can see the difference and will not judge this as crossposting.
I want to say thank you to every contributor in the other thread. I appreciate the will to help. Though the title of the other thread was asking a different thing than I want to ask here.
Now I'm strictly focused on manually (which is the opposite of using a ntp-sevrer) setting time in an ESP32
I have been given some hints that the ESP32-core uses the POSIX time-functions. So I tried to find some example-code showing how to setup day, month, year, hour, minute, second manually . But had no luck so far. I found websites like this https://www.boost.org/doc/libs/1_55_0/doc/html/date_time/posix_time.html#ptime_intro
But this seems to be just a list of some POSIX-function and "micro-particel-examples" of how to use a single function. What I'm looking for is a demo-code containing multiple lines of code like shown in the pseudo-code below.
written as a pseudo-code I'm searching for a ESP32-example of this
input("enter hour and press enter",UserHour)
setHour(UserHour)
input("enter minute and press enter",UserMinute)
setMinute(UserMinute)
I have an application where the ESP32 has no connection to a router but I need time-informtation with a precisision of one minute. Which means a deviation of 50-60 seconds will be OK.
So I want to adjust day, month, year, hour, minute by hand. And to do this I need a way to convert integernumbers into the time-data or through individual calls to functions that set hour, set minute etc.
I have tried to look-up "arduino alarm-watch" examples. But the examples I found where based on RTC-chips like 1307 etc. I haven't found yet an example that uses ESP32 and its internal ultra-low-power-counter which can be used for creating a clock.
best regards Stefan