Ben NanoNote TimeZone Date and Calendar HOWTO

From Qi-Hardware
Jump to: navigation, search


[edit] How to set the date, time and time zone on your Ben NanoNote and use it as a Calendar

Tested with version 2010-03-22

[edit] Setting the Time Zone

The NanoNote uses a version of Linux called OpenWrt. OpenWrt has a configuration utility called UCI. UCI modifies files in the /etc/config directory.

For example, to set your time zone to Australian Eastern Standard Time, you can use the following. A list of other time zones is given here.

uci set system.@system[0].timezone="EST-10EST,M10.1.0,M4.1.0/3"
uci commit system

If you look at the file /etc/config/system you will see that the value for the option 'timezone' has been changed from UTC to your time zone.

You now need to reboot your NanoNote to make your time zone take effect.

[edit] Setting the date and time

You can use the date command to set the date and time. For example, to set the date and time to 6:50 PM on 27 March 2010, use:

date -s "201003271850"

The format is:


Now confirm your change with the date command, and you should see something like this:

root@BenNanoNote:/# date
Sat Mar 27 18:50:47 EST 2010

The last thing to do is to set this date-time to your hardware clock, so the NanoNote will remember what time it is when it's turned off. The command is hwclock. The -w option means write the system date that you set with the date command to the hardware clock. The -l option means we're setting the clock in local time, not UTC.

hwclock -w -l

As of NanoNote software version, 2010-11-17, the hwclock command works a little differently as per Otmar Struwe on the Qi Hardware discussion list. The name of the real-time clock device has changed, so you will need to link it to the name that hwclock expects. Also the command line options are more comprehensive, so you will have to use --localtime instead of -l:

root@BenNanoNote# ln -s /dev/rtc0 /dev/rtc
root@BenNanoNote# hwclock -w --localtime

[edit] local time or UTC

Unfortunately, while the NanoNote remembers it's time, date and time zone between reboots, it does not seem to remember that the hardware clock has been set in local time rather than UTC, even using the -l for local time option for the hwclock command.

To fix this, add the following to your /etc/profile:

hwclock -l -s

This will reset the system date/time from the hardware clock in local time each time you reboot.

This is still required for version 2010-06-15.

As of NanoNote software version, 2010-11-17, the hwclock command needs long options:

hwclock --hctosys --localtime

On my system, putting the command in /etc/profile doesn't seem to work. So I added the hwclock line to my /etc/rc.local file instead. This updates the time satisfactorily after reboot.

[edit] Installing the gcal program

To save space, the OpenWrt version of Linux doesn't include all of the programs that come with a regular GNU/Linux distribution. Luckily, some people have started porting helpful programs to the NanoNote already.

The gcal program is used for printing calendars, and for keeping track of holidays and events. There's a nice tutorial on it here.

Thanks to Jiri Brozovsky, you can download a binary package for the gcal program from here.

Then you can transfer it to your NanoNote using ethernet over USB.

Once you have it on your NanoNote, install it with the opkg command. For example:

opkg install gcal_3.01-1_xburst.ipk

Then you can print a basic gcal calendar for the month with the gcal command.

[edit] Fixing the gcal format codes

One problem is that there seems to be an incompatibility between the formatting codes that gcal uses to highlight today's date with reverse print, and the NanoNote console. I get something like:

      March 2010
 Su Mo Tu We Th Fr Sa
     1  2  3  4  5  6
  7  8  9 10 11 12 13
 14 15 16 17 18 19 20
 21 22 23 24 25 26 $<2>27$<2>
 28 29 30 31         

To fix this, you need to set an environment variable:

 export TERM=linux

To make that permanent, add it to your /etc/profile file.

Thanks to Jiri Brosovsky for this solution.

--Mark Adrian Bell 12:40, 27 March 2010 (UTC)

Personal tools