setTime(NTP-time) does i exist?

Hi

I need to set the clock to NTP time and would like to do so without bits, bytes and UDP-packages to keep it simple and low traffic. My aim is to use the TimeAlarms libraries. The example sets the time with something like:

setTime(7,04,0,8,18,18);

Is there a quick fix for setting that time to any given NTP?

Kind regards,
Chris

chrven:
I need to set the clock to NTP time and would like to do so without bits, bytes and UDP-packages to keep it simple and low traffic.

Not at all sure what you mean. How do you expect to do this given that NTP time is delivered in UDP packs that consist of bytes and bits?

Can I replace the numbers after setTime with the NTP

time_t t = now();

?

chrven:
Can I replace the numbers after setTime with the NTP

Sure. You need to request the time from the NTP Server, receive the NTP packet, parse it, convert to Unix Time, and load into your data structure.

Assuming you have the WiFi Library installed in your IDE, go to:
File --> Examples --> WiFi --> WiFiUdpNtpClient

You still haven't explain how you intend to do it otherwise.

gfvalvo:
You still haven't explain how you intend to do it otherwise.

Could be a virtual Blynk pin on an Eventor or a second NodeMCU running daily a task of shortcutting to pins on the first MCU.

I find the request difficult to comprehend.

You understand that NTP (Network Time Protocol) timestamps are requested from an NTP server (of your choice) and returned using UDP and are not in local time (instead UTC) ?

Do you want implement the simplest method of synchronising your Arduino with an NTP server and presenting the results in local time ? Or what is the goal ?

6v6gt:
I find the request difficult to comprehend.

Agree.

If you're not receiving time from a NTP server (UDP packages), where are you obtaining the current time from?

I use GitHub - PaulStoffregen/Time: Time library for Arduino and it is quite efficient; update requests are every 24hrs.

Maybe I miss-understood the NTP thing. Vaguely recall, though, that there was an easier way to do it. Maybe it was connected to some library I don’t remember.
Making new thread with entire project code for suggestions.

Thanks for your time, gents…

Maybe in the meantime google for “arduino ntp clock”.
There are many examples, often based on an ESP8266, using WLAN for the network connection to an NTP server.