OpenWrt Show current time and change time zone

Source: Internet
Author: User
Tags current time set time vmware server

1. Enter date directly to display the time, or you can add-u,

root@openwrt:/# Date-u
Thu Mar 11:36:33 UTC 2016
root@openwrt:/# Date-r
Thu, 2016 11:36:49 +0000


2. Change the time zone in OpenWrt in/etc/config/systm

Changes in

Option timezone Asia/shanghai option timezone CST-8 option timezone Asia/shanghai time zone set to Asia/Shanghai
Option TimeZone CST-8 District 8

3. Change directly at compile time

Refer to this

http://blog.163.com/l1_jun/blog/static/14386388201471112948506/

Modify host name, set time zone
Modify Package/base-files/files/etc/config/system

1 2 3 4 5 6 7 8 9 10 11 12 Config system option conloglevel 8 option cronloglevel 8 option hostname Openwrt option timezone Asia/shanghai option Ti  Mezone CST-8 config timeserver ntp list server 0. openwrt.pool.ntp.org list server 1. openwrt.pool.ntp.org list Server 2. openwrt.pool.ntp.org list server 3. openwrt.pool.ntp.org Option Enable_server 0

Option hostname Openwrt SET host name
Option TimeZone Asia/shanghai time zone set to Asia/Shanghai
Option TimeZone CST-8 District 8
The list server is the NTP server.


NTP server Installation configuration Redhat server can download RPM installation package, and then execute # RPM-IVH ntp-4.2.0.a.20040617-4.x86_64.rpm or # yum-y install ntp.x86_64 time synchronization Method Sync life Make # ntpdate NTP server domain name or IP for example: # ntpdate 1.cn.pool.ntp.org http://www.pool.ntp.org is the official website of NTP, on which we can find the NTP server from our country Cn.pool.ntp.org. It has 3 server addresses: Server one: 1.cn.pool.ntp.org
Server Two: 2.asia.pool.ntp.org
Server three:        3.asia.pool.ntp.org (direct domain name sometimes has a problem, you can ping their IP first, and then synchronize with IP address) automatically run synchronization time script setting # Crontab–e Examples of adding scripts are as follows: */20 * * * *       /usr/sbin/ntpdate 210.72.145.44           //every 20 minutes 5 * * *           /usr/sbin/ntpdate 210.72.145.44          // 5:30 A.M. per day * The preceding five * numbers represent five numbers, and the value range and meaning of the numbers are as follows: minutes (0-59) hours (0-23) Date (1-31) month (1-12) weeks (0-6)//0 for Sunday after the setting is complete, use # crontab–l  View the settings above. Problem: The use of time synchronization on the virtual machine (VMware Server), although set up automatic synchronization, but sometimes time is not accurate, specific reasons I did not understand too, because sometimes good, sometimes not easy, I have not been staring at it research ~ ~ ~ There is a chance to study again ~ Linux System time Date manual modification view current time          # date modify time command           # date–s 12:12:00 Modify date command          # date –s 01/12/2008 Linux system time zone modification view current time zone          # vi/etC/sysconfig/clock Modify the time zone command          # tzselect                               or            # Timeconfig If you know the time zone name you can also use commands such as:#  tz= ' Asia/shanghai '; Export TZ//change to +8 China Shanghai time Zone or   use a new time zone file to override the system default time zone (test most effective) example  #  cp/usr/share/zoneinfo/asia/shanghai/etc/ localtime                            //Asia Shanghai Time zone replacement system time zone synchronize the BIOS clock, forcing the system to be written to the CMOS for permanent Avoid restoring to the original time after the system restarts. # clock-w View bios Time command: # hwclock-r

Welcome to join the Internet of Things industry alliance, and accumulate industry contacts and resources.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.