用linux的时候大家可能会遇到时间不对,时区不对的情况。比如使用网上廉价的国外的linux的vps,时区是国外的。那么如何在不劳烦管理员的情况下自己动手呢?首先要了解硬件时钟与系统时钟,计算机上的BIOS时间,这还得google一番,详情可参见http://kerrigan.sinaapp.com/post-6.html。当然了对于咱们来说会几个命令就行了:
hwclock -s --localtime

让硬件时间使用本地时间即可。
[root@remote ~]# hwclock --help
hwclock - query and set the hardware clock (RTC)

Usage: hwclock [function] [options...]
这里需要大家特别注意:先是函数后是参数,只用其中一个是没有用的,这是解决问题的关键

Functions:
-r | --show read hardware clock and print result #读取硬件(BIOS)时间,并显示出来
-s | --hctosys set the system time from the hardware clock #把目前系统时间调整为硬件时间
-w | --systohc set the hardware clock to the current system time #把硬件时间调整为目前系统的时间
--systz set the system time based on the current timezone #把系统时间设置为当时时区的时间

Options:
-u | --utc the hardware clock is kept in UTC #设置硬件为的UTC时间
  --localtime the hardware clock is kept in local time #设置硬件为本地时

linux时间时区设置的更多相关文章

  1. linux 的时区设置函数tzset() 【转】

    linux 的时区设置函数tzset() 本文转载于: http://blog.csdn.net/epicyong333/article/details/5258152 tzset #incude & ...

  2. Linux时间时区详解与常用时间函数

    时间与时区 整个地球分为二十四时区,每个时区都有自己的本地时间. Ø  UTC时间 与 GMT时间 我们可以认为格林威治时间就是时间协调时间(GMT = UTC),格林威治时间和UTC时间都用秒数来计 ...

  3. linux时间校准 设置时间为上海时区

      [root@localhost log]# rm -f /etc/localtime [root@localhost log]# cp /usr/share/zoneinfo/Asia/Shang ...

  4. Linux 时间时区同步

    $ sudo cp /usr/share/zoneinfo/Asia/ShangHai /etc/localtime 上述是修改系统时区 同步时间 1.  安装ntpdate工具 $ sudo apt ...

  5. linux时间校准设置,解决与本地时间不一致问题

    时间安装脚本   从NTP上把时间同步到本地 cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime 更新本地时间 ntpdate us.pool.nt ...

  6. Linux时间不准确的问题![转]

    Linux时间不准确的问题![转] 安装完系统发现时间与现实时间相差+8小时,经分析由以下产生.我们在安装时选择的是上海,而centos5把bios时间认为是utc时间,所以+8小时给我们.这个时候的 ...

  7. Linux 时间及时区设置

    时间以及时区设置 by:授客 QQ:1033553122 1.首先确认使用utc还是local time. UTC(Universal Time Coordinated)=GMT(Greenwich ...

  8. linux下的时间及时区设置

    一.时间设置及同步 1修改系统时间 #date -s 06/18/14 #date -s 14:20:50 2命令查看.设置硬件时间 #hwclock  --show 或者clock  --show ...

  9. 关于linux中的时间 时区问题

    本文部分来源于:  http://hi.baidu.com/peruke/blog/item/b8de06ec6a04583b27979132.html 系统是fedora: glibc实现了从RTC ...

随机推荐

  1. LeetCode 2. Add Two Numbers swift

    // // main.swift // leetcode02 // // Created by GuoLa on 16/1/21. // Copyright © 2016年 GuoLa. All ri ...

  2. Delete Node in a Linked List

    Write a function to delete a node (except the tail) in a singly linked list, given only access to th ...

  3. wap页面笔记

    wap页面是自行应页面 必须在head中加入 <meta content="width=device-width, initial-scale=1.0, maximum-scale=1 ...

  4. ehcache2.8.3入门示例:hello world

    一.pom.xml 依赖项 <dependency> <groupId>net.sf.ehcache</groupId> <artifactId>ehc ...

  5. MyEclipse对Struts2配置文件较检异常 Invalid result location value/parameter

    有时在编写struts.xml时会报错,但是找不出有什么她方有问题.也能正常运行 MyEclipse有地方去struts的xml进行了验证,经查找把这里 的build去掉就可以了

  6. HTML5 — 让拖放变的流行起来

    先上 Demo,尽量用 chrome,代码可参考 Github. 在 HTML5 出现之前,页面元素的拖放需要监听 mousedown.mouseover 以及 mouseup 等一系列事件,然后改变 ...

  7. C#微信公众号开发系列教程四(接收普通消息)

    微信公众号开发系列教程一(调试环境部署) 微信公众号开发系列教程一(调试环境部署续:vs远程调试) C#微信公众号开发系列教程二(新手接入指南) C#微信公众号开发系列教程三(消息体签名及加解密) C ...

  8. .NET MVC HtmlHepler

    一.HtmlHepler 1.ActionLink() 动态生成 超链接:根据路由规则,生成对应的 html 代码. //1.注册路由信息 routes.MapRoute( name: "D ...

  9. Bootstrap系列 -- 13. 内联表单

    有时候我们需要将表单的控件都在一行内显示.在Bootstrap框架中实现这样的表单效果是轻而易举的,你只需要在<form>元素中添加类名“form-inline”即可 如果你要在input ...

  10. Java关键字this、super使用总结

    版权声明:原创作品,如需转载,请与作者联系.否则将追究法律责任. 作者:熔岩日期:2007-03-01MSN :leizhimin@126.com声明:原创作品,未经授权,谢绝转载! 好久没有对所学知 ...