Getting date from local NTP Server

Hello all,

i have a local NTP server and i’m obtaining time from it every hour …
I’m using simple code made by arduino

also tried Time.h library but when i run arduino and serial monitor, it works, but it always started from the same time (4:09:46 16 1 1970) and then its uploading on the screen.

i just want the time and date an receive it as it is … could this be possible without calculating it from the base time which is something like “seconds since 1970” or something like that …

Thanks

i just want the time and date an receive it as it is ... could this be possible without calculating it from the base time which is something like "seconds since 1970" or something like that ...

On UNIX based systems the seconds since 1970 is the time. As NTP is a UNIX service it's not uncommon that most implementations build on that credo. Using these seconds you have a simple integer value you can calculate with. Calculating with human readable time values (years, months, days, hours, minutes, seconds) is horrible as their have several different bases, you don't want to do that.

also tried Time.h library but when i run arduino and serial monitor, it works, but it always started from the same time (4:09:46 16 1 1970) and then its uploading on the screen.

What does "uploading on the screeen" mean in this context?

What is your problem actually?

pylon:
What does "uploading on the screeen" mean in this context?

What is your problem actually?

it's just printing date and time to serial monitor :slight_smile:

and i actually managed to solve it. My router's a problem ... my arduino sends request packet and ntp server sends "answer" but firewall on router blocks it. to fix that, i just made a new rule in firewall :slight_smile: or another way how to fix it is using LAN NTP Server on your network (NTP Service often runs on server which is also DNS so you don't have to declare two ip addresses both for dns and ntp server :slight_smile: )