Difficulties for manual time set in Beglebone black

I have a beaglebone black with new debian iot image,
date command does to seem to change the date and time,

root@beaglebone:/etc# uname -a

Linux beaglebone 4.14.71-ti-r78 #1 SMP PREEMPT Tue Sep 25 21:14:59 UTC 2018 armv7l GNU/Linux

root@beaglebone:/etc# cat /etc/issue

Debian GNU/Linux 9 \n \l

BeagleBoard.org Debian Image 2018-08-30

Support/FAQ: http://elinux.org/Beagleboard:BeagleBoneBlack_Debian

default username:password is [debian:temppwd]

now if I run a command it says that date is changed:

root@beaglebone:/etc# date --set “2018/10/2 18:20:10”

Tue Oct 2 18:20:10 UTC 2018

but if if run date command again, it still shows original time

root@beaglebone:/etc# date

Tue Oct 9 12:42:13 UTC 2018

is there any other process for setting up time date on beaglebone?

On Tue, 9 Oct 2018 05:48:22 -0700 (PDT),
ardaei@gmail.com declaimed the following:

now if I run a command it says that date is changed:

root@beaglebone:/etc# date --set "2018/10/2 18:20:10"

Tue Oct 2 18:20:10 UTC 2018

but if if run date command again, it still shows original time

root@beaglebone:/etc# date

Tue Oct 9 12:42:13 UTC 2018

is there any other process for setting up time date on beaglebone?

  If you are connected to the Internet, the BBB runs an NTP
synchronization.

So as long as Beaglebone is connected to internet, there is no way to manually set time and date?
By the way, i didn’t see any cronjob sync time periodically, how is it getting sync after boot (if any)?

Currently we use the following to set the timezone for when the BBB is connected to the internet, as the GUI tool doesn’t work (or you don’t have GUI anyway in some cases).
This sets the US Central timezone as an example.

`

cd /etc/
sudo rm localtime
sudo ln -s /usr/share/zoneinfo/America/Chicago /etc/localtime
ls -al|grep localtime

`

Once you set that if the BBB is always online your time will automatically be correct, at least until there is some major change to DST or something that would require an update.

If you disconnect from the internet then you can use the following to set the time, we use separate time/date commands currently.

`

sudo -kS date --set year-MM-DD
sudo -kS date --set HH:MM:SS

`

Note that you have to run this on every reboot, as the BBB does not have a battery backed RTC.
If you need that functionality, the Andice labs power cape (now back in stock after parts shortage) has an RTC feature that can be used.

I have not tried to use the RTC battery backed feature on it myself, but I did test the time set/get commands and they appear to work correctly. (battery part tested and it works ok)
So then to use the battery RTC you would just need to add a time set on bootup service. (run once type service)

Note that to use this manual timeset when online, or use the battery backed RTC time set software from an I2C chip, you need to go on the command line and remove/disable the network time service.
I haven’t tried that myself but one of the following should work:

`

sudo timedatectl set-ntp off
sudo systemctl stop ntp.service

`

If you make a GUI tool like I did to set the time when offline, you need to add the corresponding NTP service enable (when online) for completeness.

Bill

It appears that if BBB is not connected to internet, i can set the date and time with date command.
this should take care of the issue for me.
i was following steps on :
https://learn.adafruit.com/adding-a-real-time-clock-to-beaglebone-black/wiring-the-rtc
but that did not add the DS1307 to the system, so my plan B is writing a script to read DS1307 directly and update the system in case of no internet.