# Time synchronization

**URL:** <https://forums.balena.io/t/time-synchronization/941>\
**Category:** Product support\
**Tags:** systemd\
**Created:** [May 11, 2017, 3:29am UTC](https://forums.balena.io/t/time-synchronization/941 "2017-05-11T03:29:17Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sunil](https://avatars.discourse-cdn.com/v4/letter/s/5fc32e/32.png) [@sunil](https://forums.balena.io/u/sunil)\
**Post date:** [May 11, 2017, 3:29am UTC](https://forums.balena.io/t/time-synchronization/941/1 "2017-05-11T03:29:17Z")

</div>

Hi, I’ve noticed in my build the etc/systemd/timesyncd.conf is empty. There also is no /var/lib/systemd/clock/ folder The issue I’m dealing with is the device seems to have the right NTP time, but the incorrect TZ. It’s been up for over 72 hours and I know the RPi’s clock should drift a bit, but it hasn’t yet. Separately, it looks like port 123 is blocked when I run netstat -ap. I followed this : [https://docs.resin.io/runtime/runtime/#checking-if-device-time-is-ntp-synchronized](https://docs.resin.io/runtime/runtime/#checking-if-device-time-is-ntp-synchronized) and the error I get is dbus-send command not found

---

<div class="post-metadata">

**Author:** ![imrehg](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/imrehg/32/36_2.png) [@imrehg](https://forums.balena.io/u/imrehg)\
**Post date:** [May 11, 2017, 8:01am UTC](https://forums.balena.io/t/time-synchronization/941/3 "2017-05-11T08:01:03Z")

</div>

Hi, the time management happens in the host OS, not in the user application container. You are on the right track, but those files and services are in the host OS.

Here’s what we do for time management in a bit more detail (and we’ll be adding more info to it over time):

> **[Time management - Balena Documentation](https://www.balena.io/docs/reference/OS/time/)**
>
> How time is synchronized and managed for balena devices

The `dbus-send` command doesn’t work for you because to use that, you have to install it in your user container (that’s not installed by default, because the base images are kept to minimal, the users chose what do they need). In case of Debian base images for example, it is provided by the `dbus` package. Afterwards you’ll be able to use that example command. We’ll make this even clearer in the documentation that you link to.

The devices are using UTC timezones by default (as it is a standard practice, and we cannot guess which timezones the devices will be deployed at 🕰 ). ~~If you’d like to change the device time zone, you can probably use a similar `dbus-send` command to do that. You’d need to check with the [documentation of timedated](https://www.freedesktop.org/wiki/Software/systemd/timedated/), as that’s the service to call, just like in the example.~~ Edit: looks previous suggestion wouldn’t work, as to be minimal, the `zoneinfo` data is not installed in the host OS. On the other hand, to change time zone within your container (which is what should matter to you ultimately, you can check out the following example code (the gist is reconfiguring the operating system that is within the container):

> **[balena-io-examples/balena-timezone](https://github.com/balena-io-examples/balena-timezone)**
>
> Example to set the timezone on a resin device. Contribute to balena-io-examples/balena-timezone development by creating an account on GitHub.

Regarding port 123, are you looking for whether there’s a process listening on that port, or connecting out? There should be nothing listening because there’s no ntp server by default on the device.

Hope this will be useful!

---

<div class="post-metadata">

**Author:** ![sunil](https://avatars.discourse-cdn.com/v4/letter/s/5fc32e/32.png) [@sunil](https://forums.balena.io/u/sunil)\
**Post date:** [May 11, 2017, 2:38pm UTC](https://forums.balena.io/t/time-synchronization/941/4 "2017-05-11T14:38:25Z")

</div>

Hi Gergely,

Thanks for your quick reply. I followed your resin-timezone repo and it works perfectly.

The Resin dashboard has approximate location and I know that can be masked due to VPNs, but it may be a cool feature to add recognized TZ based off location in the future.

To answer your p 123 question, I wanted to know if the ntp client was connecting out to [pool.ntp.org](http://pool.ntp.org) or any other of the ntp servers, as the documentation suggests to check.

For any future readers my base rpi3 image is: resin/%%RESIN\_MACHINE\_NAME%%-node:latest

Thanks again!

---

<div class="post-metadata">

**Author:** ![imrehg](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/imrehg/32/36_2.png) [@imrehg](https://forums.balena.io/u/imrehg)\
**Post date:** [May 11, 2017, 4:46pm UTC](https://forums.balena.io/t/time-synchronization/941/5 "2017-05-11T16:46:43Z")

</div>

Hi Sunil, the logs in the dashboard show the time according to your own location, so that should be good for one set of clarity. For the device’s own clock, we think that “servers” (which in our minds these devices are in most cases) should run on UTC for clarity, and if the users need differently, have an option to change that (as shown above) 🙂

Regarding the port, I don’t think that the ntp process keeps that port open, once the time is synchronized, it will connect only occasionally, not keeping the connection open. I was trying on my local machine to catch `timesyncd` in the act with `netstat`, but couldn’t. `systemctl status` shows that the status is synchronized, though (on a [resin.io](http://resin.io) device that should be checked in the hostOS, for example on a `-dev` machine).

Cheers!

---

<div class="post-metadata">

**Author:** ![imrehg](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/imrehg/32/36_2.png) [@imrehg](https://forums.balena.io/u/imrehg)\
**Post date:** [July 18, 2017, 8:00pm UTC](https://forums.balena.io/t/time-synchronization/941/6 "2017-07-18T20:00:42Z")

</div>

13 posts were split to a new topic: [Timezone setting in Alpine images](https://forums.balena.io/t/timezone-setting-in-alpine-images/1486)
