{"id":6984,"date":"2017-09-12T14:47:59","date_gmt":"2017-09-12T06:47:59","guid":{"rendered":"http:\/\/rmohan.com\/?p=6984"},"modified":"2017-09-12T14:47:59","modified_gmt":"2017-09-12T06:47:59","slug":"manage-time-service-on-rh-and-centos-7","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=6984","title":{"rendered":"Manage Time service on RH and CentOS 7"},"content":{"rendered":"<p>When Linux system first boots the hardware clock is read first. The time on the hardware clock read from local hardware clock in UTC \u2013 Universal Time. Local time is the actual time in the current time zone. System time, unlike Hardware clock maintained by operating system. System clock is completely independent of the hardware clock.<br \/>\nHow to manage time<br \/>\nCommand\tDescription<br \/>\ndate\tManage local time<br \/>\nhwclock\tManage hardware time<br \/>\ntimedatectl\tManage time on CentOS 7 or RH 7<br \/>\nExamples of using date<br \/>\nroot@on ~]# date<br \/>\nWed Jun  7 13:34:40 EDT 2017<br \/>\n[root@on ~]# date +%d-%m-%y<br \/>\n07-06-17<br \/>\n[root@on ~]# date -s 13:40:00<br \/>\nWed Jun  7 13:40:00 EDT 2017<br \/>\n[root@on ~]# date<br \/>\nWed Jun  7 13:40:05 EDT 2017<br \/>\n[root@on ~]#<br \/>\nExamples of using hwclock<br \/>\n[root@on ~]# hwclock -c<br \/>\nhw-time      system-time         freq-offset-ppm   tick<br \/>\n1496857021   1496857310.458797<br \/>\n1496857031   1496857320.459274                48      0<br \/>\n1496857041   1496857330.459571                39      0<br \/>\n[root@on ~]# hwclock &#8211;systohc<br \/>\n[root@on ~]# hwclock -c<br \/>\nhw-time      system-time         freq-offset-ppm   tick<br \/>\n1496857353   1496857353.012685<br \/>\n1496857363   1496857363.013179                49      0<br \/>\n1496857373   1496857373.013471                39      0<br \/>\nhwclock command\tmeaning<br \/>\nhwclock -c\tshows the difference between hardware time and system time.<br \/>\nThe output of this command is refreshed every 10 seconds. Listing 24.1 shows<br \/>\nthe output of this command.<br \/>\nhwclock \u2013systohc\tsynchronizes current system time to the hardware clock.<br \/>\nhwclock \u2013hctosys\tsynchronizes current hardware time to the system clock.<br \/>\nExamples using timedatectl command<br \/>\n[root@on ~]# timedatectl<br \/>\n      Local time: Wed 2017-06-07 13:48:01 EDT<br \/>\n  Universal time: Wed 2017-06-07 17:48:01 UTC<br \/>\n        RTC time: Wed 2017-06-07 17:48:01<br \/>\n       Time zone: America\/New_York (EDT, -0400)<br \/>\n     NTP enabled: n\/a<br \/>\nNTP synchronized: no<br \/>\n RTC in local TZ: no<br \/>\n      DST active: yes<br \/>\n Last DST change: DST began at<br \/>\n                  Sun 2017-03-12 01:59:59 EST<br \/>\n                  Sun 2017-03-12 03:00:00 EDT<br \/>\n Next DST change: DST ends (the clock jumps one hour backwards) at<br \/>\n                  Sun 2017-11-05 01:59:59 EDT<br \/>\n                  Sun 2017-11-05 01:00:00 EST<br \/>\n[root@on ~]# timedatectl list-timezones<br \/>\nAfrica\/Abidjan<br \/>\nAfrica\/Accra<br \/>\nAfrica\/Addis_Ababa<br \/>\nAfrica\/Algiers<br \/>\nAfrica\/Asmara<br \/>\nAfrica\/Bamako<br \/>\nAfrica\/Bangui<br \/>\n&#8230;.<br \/>\n[root@on ~]# timedatectl set-timezone America\/Toronto<br \/>\n[root@on ~]# timedatectl<br \/>\n      Local time: Wed 2017-06-07 13:50:09 EDT<br \/>\n  Universal time: Wed 2017-06-07 17:50:09 UTC<br \/>\n        RTC time: Wed 2017-06-07 17:50:09<br \/>\n       Time zone: America\/Toronto (EDT, -0400)<br \/>\n     NTP enabled: n\/a<br \/>\nNTP synchronized: no<br \/>\n RTC in local TZ: no<br \/>\n      DST active: yes<br \/>\n Last DST change: DST began at<br \/>\n                  Sun 2017-03-12 01:59:59 EST<br \/>\n                  Sun 2017-03-12 03:00:00 EDT<br \/>\n Next DST change: DST ends (the clock jumps one hour backwards) at<br \/>\n                  Sun 2017-11-05 01:59:59 EDT<br \/>\n                  Sun 2017-11-05 01:00:00 EST<br \/>\n[root@on ~]# <\/p>\n","protected":false},"excerpt":{"rendered":"<p>When Linux system first boots the hardware clock is read first. The time on the hardware clock read from local hardware clock in UTC \u2013 Universal Time. Local time is the actual time in the current time zone. System time, unlike Hardware clock maintained by operating system. System clock is completely independent of the hardware [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[73],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6984"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6984"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6984\/revisions"}],"predecessor-version":[{"id":6985,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6984\/revisions\/6985"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6984"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6984"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6984"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}