I am using raspberry pi 4 as a gateway to my esp8266 devices. I have connected ethernet to pi for internet connection. It works fine. I want to generate ntp time in my esp8266 device. When I connect devices to direct wifi they are getting right time. But when I connect them to pi gateway they are getting date 01.01.1970 . How to get current date from pi gateway ?
Recent Raspberry Pi OS includes
systemd-timesyncd as the NTP client. Unfortunately for you,
systemd-timesyncd does not implement the server functionality, so it cannot provide network time to clients downstream.
You'll have to set up a full-featured NTP server such as
chrony (you may disable
systemd-timesyncd, but you don't have to: it is polite enough not to interfere). Or, if you have any of these set up already, you need to configure them to act as a server.