Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Real-time display of `date` changes on Linux

On an embedded Linux device that does not present /dev/rtc*, how can I set off a console window writing the value of the Real-Time Clock to the console, on the tick, every time it changes?

Results would be like:

$ **someCmd**
Mon Mar 14 16:43:22 UTC 2011
Mon Mar 14 16:43:23 UTC 2011
Mon Mar 14 16:43:24 UTC 2011
Mon Mar 14 16:43:25 UTC 2011
Mon Mar 14 16:43:26 UTC 2011

etc.

The device is armv5tejl running BusyBox v1.13.3.

like image 312
Lightness Races in Orbit Avatar asked Mar 14 '11 16:03

Lightness Races in Orbit


2 Answers

Use the watch commad, try this is: watch -n 1 date

like image 110
Marco Coutinho Avatar answered Oct 21 '22 01:10

Marco Coutinho


I don't know how much the BusyBox shell supports, but in sh you could do something like this:

{ while true ; do date ; sleep 0.1 ; done } | uniq
like image 44
Thomas Avatar answered Oct 21 '22 00:10

Thomas