zoukankan      html  css  js  c++  java
  • 修改 timezone

    1、通过命令修改

    1、Set Time, Date Timezone in Linux from Command Line or Gnome | Use ntp

    2、Use TZ database

    3、tzset(3) - Linux man page

    4、世界时区图

    5、在开发板上通过设置系统环境变量TZ设置。

    比方设置成 东八区即 中国上海/Shanghai 时间
    ①设置timezone 环境变量

    TZ=GMT-8或者TZ=GMT-08:00或者TZ=GMT-08
    export TZ
    
    

    NOTE:不能设置成 TZ=GMT-0800,这样是设置成了800:00了。

    如果是设置成 西八区即 美国西雅图/Seattle 时间

    TZ=GMT8
    export TZ
    
    

    注意:这里不能写成 GMT+8,否则时间会不断地在减少。Note :

    ③ 建立.profile文件,然后将上面的写进去。

    ④问题来了。这里的TZ是相对时区,执行一次这个.profile,系统就会相应地增加或减少,而不是一个绝对值。

    6、UTC和GMT的区别
    UTC:Coordinated Universal Time
    GMT:Greenich Mean Time

    7、世界时区图

    World Time Zone

    8、NTP/Network Time Protocol

    9、夏令时/Summer Time, Daylight Saving Time/DST

    REFER: Time & Date

    10、tzset
    查看tzset(man tzset)

    11、date与hwclock
    date +%z会输出当前的时钟
    date -R
    date -u 显示UTC的时间也就是Greenwich时区/0时区的时间
    hwclock -u显示UTC同样是Greenwich时区/0时区的时间

    12、读取配置文件
    ①/etc/localtime

    $ zdump /etc/localtime
    

    ②/usr/share/zoneinfo/

    13、zdump 查看夏令时和时区
    zdump : zone-info dumper

    $ zdump -v /usr/share/zoneinfo/GB
    

    其中,struct tm结构体(在 <time.h>中),是有is_dst(是否存在夏令时/daylight_saving_time)

    在Linux中,Linux是如何根据 DST/daylight_saving_time来 计算 当地时间的呢?

  • 相关阅读:
    resourceTree PuTTY/Plink
    error: src refspec 202110221_v1_master does not match any error: failed to push some refs to 'https://gitee.com/simadongyang/m9v1.0'
    go笔记10
    go协程池
    go笔记08
    go笔记06
    go笔记04
    go笔记03
    Git常用命令一
    ajax调用实例
  • 原文地址:https://www.cnblogs.com/xuanyuanchen/p/6182181.html
Copyright © 2011-2022 走看看