Вторник, 27.06.2017
BBB Ready!
Меню сайта
Статистика

Онлайн всего: 1
Гостей: 1
Пользователей: 0
Главная » 2015 » Июнь » 16 » Watch and clocks, TZ and time(NULL), BBB
21:34
Watch and clocks, TZ and time(NULL), BBB

1. Sync time

The problem is to synchronize time on bbb. My device, after power on, querry time from server and set up linux time:

system( "date 061621252015.42" );

But time(NULL) results UTC time (i think). Well, the answer is set TZ variable to UTC before setup time:

setenv("TZ", "UTC", 1);
system( dateCommand.c_str() );

Well, this is working propertly.

2. Drift? time

Almost ;)

This time lags about 10 min for 1 hour.

Experiment:

1. set hwclock from sysclock 
2. wait 30 minutes

Result: diff = 11 +- 2 sec

root@beaglebone:~# hwclock -u
Tue Jun 16 21:33:15 2015  0.000000 seconds
root@beaglebone:~# date
Tue Jun 16 21:33:04 UTC 2015

3. wait 55 min

Result: diff = 2:30 !!

root@beaglebone:~# date
Tue Jun 16 22:02:48 UTC 2015
root@beaglebone:~# hwclock -u
Tue Jun 16 22:05:32 2015  0.000000 seconds
root@beaglebone:~# date
Tue Jun 16 22:02:53 UTC 2015

Second question, Is hwclock show correct time?

I hope yes.

Experiment:

22:08:00

root@beaglebone:~# hwclock -u
Tue Jun 16 22:08:09 2015  0.000000 seconds

 

 

(My device is not use my time to sync, then 9sec is ok )

23:11:00

root@beaglebone:~# hwclock -u
Tue Jun 16 23:11:09 2015  0.000000 seconds

 

Looks good!)
Просмотров: 102 | Добавил: bobapro | Рейтинг: 0.0/0
Всего комментариев: 0
Имя *:
Email *:
Код *:
Форма входа
Поиск
Календарь
«  Июнь 2015  »
ПнВтСрЧтПтСбВс
1234567
891011121314
15161718192021
22232425262728
2930
Архив записей
Друзья сайта
  • Официальный блог
  • Сообщество uCoz
  • FAQ по системе
  • Инструкции для uCoz
  • Copyright MyCorp © 2017
    Бесплатный хостинг uCoz