Re: updating system with local time


Ross Burton <ross@...>
 

Package /etc/timezone as a symlink to /run/timezone, and write to that instead?

Ross

On Tue, 4 Jan 2022 at 17:35, Arik Kleiman <arik.kleiman@...> wrote:

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:

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
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

Join yocto@lists.yoctoproject.org to automatically receive all group messages.