0

I am using Ubuntu 20.04 server edition on a RPi 4. I have seen tutorials and posts on how to set the local time manually. However, I would like to set the device to automatically update the local time zone to reflect any changes using NTP. For instance, if I have the device running in Eastern time zone and then take it with me to the Pacific time zone or even to Europe, I want it to automatically update this info and display it with the "date" command as long as it has a connection to the outside world. I appreciate the guidance.

Seeing the following when running timedatectl

ubuntu@ubuntu:~$ timedatectl

Local time: Mon 2021-11-29 15:28:14 UTC

Universal time: Mon 2021-11-29 15:28:14 UTC

RTC time: n/a

Time zone: Etc/UTC (UTC, +0000)

System clock synchronized: yes

NTP service: active

RTC in local TZ: no

date command only shows UTC

  • How will the PI detect that it's been moved, or, even, which timezone it's in? – waltinator Nov 29 '21 at 20:52
  • Was hoping it would be able to sync up with either the main gateway or via some close by NTP server. What are your thoughts? – noobuntu Nov 30 '21 at 12:59
  • NTP, and almost all internet time is in UTC (Windows keeps its time in Local Time Zone). Conversion to your local time zone is performed on your local system. That's why I asked the questions you didn't answer. – waltinator Nov 30 '21 at 18:26
  • Is RTC time usually "n/a" for Raspberry Pis? – ryanttb Nov 30 '21 at 18:38
  • Hi @waltinator. Not meaning to avoid your question. I may just not understand what it is you are asking. To add to my previous attempt in hopes of providing an answer, if I can figure out a method for the device to "sense" it's surroundings, I would probably create a script that runs upon boot up. Is this what you are asking? also, you mentioned Windows doing this with Local time. This is the behavior I am trying to create. I believe even my Nintendo Switch was able to tell what time zone it was in when I first set it up, but it's been a while. If not possible, please let me know. – noobuntu Dec 01 '21 at 16:04
  • @ryanttb That's a valid question. I'm not sure what the typical behavior is, but will let you know today once I find out. I have not yet set a local time zone, which may the the issue here. Again, not sure and will need to find out. Thanks – noobuntu Dec 01 '21 at 16:06
  • @ryanttb I found this: "The Raspberry Pi is designed to be an ultra-low cost computer, so a lot of things we are used to on a computer have been left out. For example, your laptop and computer have a little coin-battery-powered 'Real Time Clock' (RTC) module, which keeps time even when the power is off, or the battery removed. To keep costs low and the size small, an RTC is not included with the Raspberry Pi. Instead, the Pi is intended to be connected to the Internet via Ethernet or WiFi, updating the time automatically from the global ntp (nework time protocol) servers" at Adafruit.com – noobuntu Dec 01 '21 at 16:58
  • You can change the timezone manually. See https://askubuntu.com/questions/3375/how-to-change-time-zone-settings-from-the-command-line – waltinator Dec 01 '21 at 17:03
  • @waltinator No, but thanks. Manually isn't what I'm wanting. I don't know how to proceed on this. Would be nice to have an application I can include in the build, but not sure if here is such a thing. At this moment, I'm going to say it's probably not possible. However, I will keep researching. Thanks for the input. – noobuntu Dec 06 '21 at 15:38
  • Unless you add a GPS dongle to find out where you are, OR compare the first few hops of traceroute 8.8.8.8, OR figure out a computer-detectable difference between the environments your computer lacks the information to guess a timezone. – waltinator Dec 06 '21 at 18:56

0 Answers0