Skip to content
This repository has been archived by the owner on Mar 17, 2018. It is now read-only.

Using time zones

zyxmon edited this page Jul 9, 2016 · 5 revisions

Introduction

If some of Entware-ng daemons uses GMT time instead of local time, you may fix it by following this manual.

Requirements

For ARM/x86 devices only: you should have write access to /etc.

Using time zones on MIPS devices

Just put local zone name to /opt/etc/TZ.

echo UCT-8 > /opt/etc/TZ

There is the other ways to set up time zone on MIPS devices, like TZ variable or linking /opt/etc/TZ with full time zone file from zoneinfo*, but this is the simplest one.

Using time zones on ARM and x86 devices

List available time zone packages:

opkg list zoneinfo*

Install desired one:

opkg install zoneinfo-europe

Create /opt/etc/TZ symlink to chosen time zone:

ln -sf /opt/share/zoneinfo/Europe/Moscow  /etc/localtime 

Some of firmwares (Tomato, asuswrt and others) keeps /etc/ in tmpfs so it will be lost on the next boot. Create a script /opt/etc/init.d/S00timezone, that makes a symlink at boot time:

#!/bin/sh

start() {
    ln -sf /opt/share/zoneinfo/Europe/Moscow  /etc/localtime
}

stop() {
    rm -rf /etc/localtime
}

case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    restart)
        stop
        start
    ;;
    *)
    echo "Usage: $0 {start|stop}"
    ;;
esac

and make it executable:

chmod +x /opt/etc/init.d/S00timezone

Some firmwares to not have write access to /etc folder. In this case you can set timezone through TZ variable by setting it to TZ=:/opt/share/zoneinfo/Europe/Moscow. Just add this line to /opt/etc/init.d/rc.unslung before the services cycle. Add export TZ=:/opt/share/zoneinfo/Europe/Moscow to .profile in your HOME directory or to /opt/etc/profile (globally).

Links