Date
1 - 9 of 9
updating system with local time
Arik Kleiman
Hi, Is there any way to update my Read Only system (which connected to the world via cellular) with local time? Im able to get the local time zone from ip lookup ... but can't use it to update the system current time. Thanks, Arik
|
|
Ross Burton <ross@...>
Just use something like NTP to sync the local time. There's a number
toggle quoted messageShow quoted text
of recipes that can do this, such as systemd/ntp/ntpdate. Ross
On Tue, 4 Jan 2022 at 07:47, Arik Kleiman <arik.kleiman@...> wrote:
|
|
Arik Kleiman
The thing is that ntpdate syncs system time to UTC How can i set my system's time according to time zone?
On Tue, Jan 4, 2022, 14:05 Ross Burton <ross@...> wrote: Just use something like NTP to sync the local time. There's a number
|
|
Michael Opdenacker
Hi Arik,
On 1/4/22 1:15 PM, Arik Kleiman wrote: The thing is that ntpdate syncs system time to UTC If you're using systemd, you could use the timedatectl command: https://linuxiac.com/how-to-set-timezone-and-sync-server-time-with-ntp-in-linux/ Otherwise, you can add the "tzdata" recipe to your image. It should allow you to set the timezone that you want: https://www.yoctoproject.org/pipermail/yocto/2018-October/042964.html Cheers Michael. -- Michael Opdenacker, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
|
|
Arik Kleiman
I don't have option to add systemd. Added alrady tzdata and all time zone folders exist. The issue is that ntpdate returns time in UTC. I found a way to get local time zone (by using ip lookup). Now i looking for a way to use it to update system time
On Tue, Jan 4, 2022, 15:47 Michael Opdenacker <michael.opdenacker@...> wrote: Hi Arik,
|
|
Arik Kleiman
From what i read, there is a way to do this using timedatectl (its part of systemd). Anyone knows what recipe i need for that?
On Tue, Jan 4, 2022, 16:58 Arik Kleiman via lists.yoctoproject.org <arik.kleiman=gmail.com@...> wrote:
|
|
Ross Burton <ross@...>
On Tue, 4 Jan 2022 at 14:58, Arik Kleiman <arik.kleiman@...> wrote:
Just write a small tool to map the local timezone from the IP lookup to a timezone name (such as Europe/London) and write it to /etc/timezone. You could do that with a short ifup script. That said, for headless appliances working in UTC is absolutely fine, and for user-facing devices it's perfectly acceptable to ask the user what the timezone is, as your geo-IP lookup might be incorrect anyway. Ross
|
|
Arik Kleiman
can't write it to /etc/localtime ... it's a read only system. There is an environment variable named TZ, when ever it is changed, local time is changed as well. Is there a way (by script or cron job) to set the way system will update as well? 10x, Arik
On Tue, Jan 4, 2022 at 5:46 PM Ross Burton <ross@...> wrote: On Tue, 4 Jan 2022 at 14:58, Arik Kleiman <arik.kleiman@...> wrote:
|
|
Ross Burton <ross@...>
Package /etc/timezone as a symlink to /run/timezone, and write to that instead?
toggle quoted messageShow quoted text
Ross
On Tue, 4 Jan 2022 at 17:35, Arik Kleiman <arik.kleiman@...> wrote:
|
|