2

I am using Raspberry Pi 4 as a gateway to my esp8266 devices. I have connected ethernet to Raspberry Pi for internet connection. It works fine. I want to generate NTP time in my ESP8266 device.

When I connect the devices to direct Wi-Fi they are getting right time. But when I connect them to Raspberry Pi gateway they are getting date 01.01.1970 .

How to get current date from Raspberry Pi gateway?

MatsK
2,8833 gold badges18 silver badges22 bronze badges
asked Sep 8, 2020 at 13:17
1
  • Is the RasPi connected to the internet? Does esp8266 have wired and WiFi interfaces? Commented Sep 8, 2020 at 17:52

1 Answer 1

3

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 ntp, openntpd or 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.

answered Sep 9, 2020 at 13:41
1
  • 1
    I think your answer is correct, which is to say I interpret the question as you do. However, I do suggest one correction: There is no need to disable systemd-timesyncd - it politely "steps aside" if another NTP server is running. See this old-ish answer, or review systemctl cat systemd-timesyncd Commented Sep 9, 2020 at 21:47

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.