All of lore.kernel.org
 help / color / mirror / Atom feed
* updating system with local time
@ 2022-01-04  7:47 Arik Kleiman
  2022-01-04 12:05 ` [yocto] " Ross Burton
  0 siblings, 1 reply; 8+ messages in thread
From: Arik Kleiman @ 2022-01-04  7:47 UTC (permalink / raw)
  To: yocto

[-- Attachment #1: Type: text/plain, Size: 235 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 422 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [yocto] updating system with local time
  2022-01-04  7:47 updating system with local time Arik Kleiman
@ 2022-01-04 12:05 ` Ross Burton
  2022-01-04 12:15   ` Arik Kleiman
  0 siblings, 1 reply; 8+ messages in thread
From: Ross Burton @ 2022-01-04 12:05 UTC (permalink / raw)
  To: Arik Kleiman; +Cc: yocto

Just use something like NTP to sync the local time. There's a number
of recipes that can do this, such as systemd/ntp/ntpdate.

Ross

On Tue, 4 Jan 2022 at 07:47, Arik Kleiman <arik.kleiman@gmail.com> wrote:
>
> 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
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#55714): https://lists.yoctoproject.org/g/yocto/message/55714
> Mute This Topic: https://lists.yoctoproject.org/mt/88186305/1676615
> Group Owner: yocto+owner@lists.yoctoproject.org
> Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [ross@burtonini.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [yocto] updating system with local time
  2022-01-04 12:05 ` [yocto] " Ross Burton
@ 2022-01-04 12:15   ` Arik Kleiman
       [not found]     ` <e8b3d35c-4752-d2ca-ba1a-22040aeca3cb@bootlin.com>
  0 siblings, 1 reply; 8+ messages in thread
From: Arik Kleiman @ 2022-01-04 12:15 UTC (permalink / raw)
  To: Ross Burton; +Cc: yocto

[-- Attachment #1: Type: text/plain, Size: 1085 bytes --]

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@burtonini.com> wrote:

> Just use something like NTP to sync the local time. There's a number
> of recipes that can do this, such as systemd/ntp/ntpdate.
>
> Ross
>
> On Tue, 4 Jan 2022 at 07:47, Arik Kleiman <arik.kleiman@gmail.com> wrote:
> >
> > 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
> >
> > -=-=-=-=-=-=-=-=-=-=-=-
> > Links: You receive all messages sent to this group.
> > View/Reply Online (#55714):
> https://lists.yoctoproject.org/g/yocto/message/55714
> > Mute This Topic: https://lists.yoctoproject.org/mt/88186305/1676615
> > Group Owner: yocto+owner@lists.yoctoproject.org
> > Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [
> ross@burtonini.com]
> > -=-=-=-=-=-=-=-=-=-=-=-
> >
>

[-- Attachment #2: Type: text/html, Size: 2093 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [yocto] updating system with local time
       [not found]     ` <e8b3d35c-4752-d2ca-ba1a-22040aeca3cb@bootlin.com>
@ 2022-01-04 14:58       ` Arik Kleiman
  2022-01-04 15:46         ` Ross Burton
       [not found]       ` <16C71934C97A8A71.28298@lists.yoctoproject.org>
  1 sibling, 1 reply; 8+ messages in thread
From: Arik Kleiman @ 2022-01-04 14:58 UTC (permalink / raw)
  To: Michael Opdenacker; +Cc: Ross Burton, yocto

[-- Attachment #1: Type: text/plain, Size: 985 bytes --]

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@bootlin.com> wrote:

> Hi Arik,
>
> On 1/4/22 1:15 PM, Arik Kleiman wrote:
> > The thing is that ntpdate syncs system time to UTC
> >
> > How can i set my system's time according to time zone?
>
>
> 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
>
>

[-- Attachment #2: Type: text/html, Size: 1820 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [yocto] updating system with local time
       [not found]       ` <16C71934C97A8A71.28298@lists.yoctoproject.org>
@ 2022-01-04 15:43         ` Arik Kleiman
  0 siblings, 0 replies; 8+ messages in thread
From: Arik Kleiman @ 2022-01-04 15:43 UTC (permalink / raw)
  To: Arik Kleiman; +Cc: Michael Opdenacker, Ross Burton, yocto

[-- Attachment #1: Type: text/plain, Size: 1684 bytes --]

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@lists.yoctoproject.org> 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
>
> On Tue, Jan 4, 2022, 15:47 Michael Opdenacker <
> michael.opdenacker@bootlin.com> wrote:
>
>> Hi Arik,
>>
>> On 1/4/22 1:15 PM, Arik Kleiman wrote:
>> > The thing is that ntpdate syncs system time to UTC
>> >
>> > How can i set my system's time according to time zone?
>>
>>
>> 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
>>
>>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#55721):
> https://lists.yoctoproject.org/g/yocto/message/55721
> Mute This Topic: https://lists.yoctoproject.org/mt/88186305/6638820
> Group Owner: yocto+owner@lists.yoctoproject.org
> Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [
> arik.kleiman@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>

[-- Attachment #2: Type: text/html, Size: 3435 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [yocto] updating system with local time
  2022-01-04 14:58       ` Arik Kleiman
@ 2022-01-04 15:46         ` Ross Burton
  2022-01-04 17:35           ` Arik Kleiman
  0 siblings, 1 reply; 8+ messages in thread
From: Ross Burton @ 2022-01-04 15:46 UTC (permalink / raw)
  To: Arik Kleiman; +Cc: Michael Opdenacker, yocto

On Tue, 4 Jan 2022 at 14:58, Arik Kleiman <arik.kleiman@gmail.com> 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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [yocto] updating system with local time
  2022-01-04 15:46         ` Ross Burton
@ 2022-01-04 17:35           ` Arik Kleiman
  2022-01-05  9:17             ` Ross Burton
  0 siblings, 1 reply; 8+ messages in thread
From: Arik Kleiman @ 2022-01-04 17:35 UTC (permalink / raw)
  To: Ross Burton; +Cc: Michael Opdenacker, yocto

[-- Attachment #1: Type: text/plain, Size: 1112 bytes --]

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@burtonini.com> wrote:

> On Tue, 4 Jan 2022 at 14:58, Arik Kleiman <arik.kleiman@gmail.com> 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
>

[-- Attachment #2: Type: text/html, Size: 1798 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [yocto] updating system with local time
  2022-01-04 17:35           ` Arik Kleiman
@ 2022-01-05  9:17             ` Ross Burton
  0 siblings, 0 replies; 8+ messages in thread
From: Ross Burton @ 2022-01-05  9:17 UTC (permalink / raw)
  To: Arik Kleiman; +Cc: Michael Opdenacker, yocto

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@gmail.com> 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@burtonini.com> wrote:
>>
>> On Tue, 4 Jan 2022 at 14:58, Arik Kleiman <arik.kleiman@gmail.com> 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


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-01-05  9:17 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-04  7:47 updating system with local time Arik Kleiman
2022-01-04 12:05 ` [yocto] " Ross Burton
2022-01-04 12:15   ` Arik Kleiman
     [not found]     ` <e8b3d35c-4752-d2ca-ba1a-22040aeca3cb@bootlin.com>
2022-01-04 14:58       ` Arik Kleiman
2022-01-04 15:46         ` Ross Burton
2022-01-04 17:35           ` Arik Kleiman
2022-01-05  9:17             ` Ross Burton
     [not found]       ` <16C71934C97A8A71.28298@lists.yoctoproject.org>
2022-01-04 15:43         ` Arik Kleiman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.