{"id":868,"date":"2011-07-03T15:47:23","date_gmt":"2011-07-03T15:47:23","guid":{"rendered":""},"modified":"2021-06-20T12:43:17","modified_gmt":"2021-06-20T04:43:17","slug":"setting-date-time-linux","status":"publish","type":"post","link":"https:\/\/www.munmon.com\/v3\/2011\/07\/03\/setting-date-time-linux\/","title":{"rendered":"Setting up Date &#038; Time in Linux"},"content":{"rendered":"<p>Sometimes after reboot, Linux Date &amp; Time Settings will go haywire for no apparent reason. It will be delayed for several minutes. I do not know, maybe this happens only to my server. For security reason me office blocks access to port 123 \u2013 NTP port.<\/p>\n<p>Server has 2 types of clocks just like any PCs. First is the System Clock and the other one is the Hardware Clock. Take Hardware Clock as PCs CMOS\u2019s clock and System Clock as Windows Clock.<\/p>\n<p>Hardware Clock | Runs forever until your server goes kaput.<br \/>System Clock | Runs when your system is running<\/p>\n<p>So, How do you correct Server\u2019s Time &amp; Date setting? This is very important for one of these reasons<\/p>\n<ul>\n<li>Troubleshooting \u2013 you will need to know when shit happens<\/li>\n<li>CRON Jobs \u2013 Without correct timing, cron will run at unexpected time.<\/li>\n<li>If you are using distributed System \u2013 maintaining synchronize time is a must or else \u2013 a rogue will mutilate you from behind.\\<\/li>\n<li>If you are using Daylight Saving\u2026<\/li>\n<li>Etc<\/li>\n<\/ul>\n<p><strong>You must be Root to use this command<\/strong><\/p>\n<p>Example No.1 : Set Date and Time to 3 JUL 2011 16:00:00<\/p>\n<pre>#&nbsp; date -s \"3 JUL 2011 16:00:00\"<\/pre>\n<p>&nbsp;<\/p>\n<p>Example No.2 : Set Time Only to 16:00:00<\/p>\n<pre>#&nbsp; date +%T -s \"16:00:00\"<\/pre>\n<p>&nbsp;<\/p>\n<p>Then run this command<\/p>\n<pre># hwclock --systohc<\/pre>\n<p>&nbsp;<\/p>\n<p>To sync Hardware Clock with System Clock<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sometimes after reboot, Linux Date &amp; Time Settings will go haywire for no apparent reason. It will be delayed for several minutes. I do not know, maybe this happens only to my server. For security reason me office blocks access to port 123 \u2013 NTP port.<\/p>\n<p>Server has 2 types of clocks just like any PCs. First is the System Clock and the other one is the Hardware Clock. Take Hardware Clock as PCs CMOS\u2019s clock and System Clock as Windows Clock.<\/p>\n<p>Hardware Clock | Runs forever until your server goes kaput.<br \/>System Clock | Runs when your system is running<\/p>\n<p>So, How do you correct Server\u2019s Time &amp; Date setting? This is very important for one of these reasons<\/p>\n<ul>\n<li>Troubleshooting \u2013 you will need to know when shit happens<\/li>\n<li>CRON Jobs \u2013 Without correct timing, cron will run at unexpected time.<\/li>\n<li>If you are using distributed System \u2013 maintaining synchronize time is a must or else \u2013 a rogue will mutilate you from behind.\\<\/li>\n<li>If you are using Daylight Saving\u2026<\/li>\n<li>Etc<\/li>\n<\/ul>\n<p><strong>You must be Root to use this command<\/strong><\/p>\n<p>Example No.1 : Set Date and Time to 3 JUL 2011 16:00:00<\/p>\n<pre>#&nbsp; date -s \"3 JUL 2011 16:00:00\"<\/pre>\n<p>&nbsp;<\/p>\n<p>Example No.2 : Set Time Only to 16:00:00<\/p>\n<pre>#&nbsp; date +%T -s \"16:00:00\"<\/pre>\n<p>&nbsp;<\/p>\n<p>Then run this command<\/p>\n<pre># hwclock --systohc<\/pre>\n<p>&nbsp;<\/p>\n<p>To sync Hardware Clock with System Clock<\/p>\n<p>&hellip;  <\/p>\n<p class=\"more-link\"><a href=\"https:\/\/www.munmon.com\/v3\/2011\/07\/03\/setting-date-time-linux\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false,"_wp_rev_ctl_limit":""},"categories":[155],"tags":[91,92,90],"class_list":["post-868","post","type-post","status-publish","format-standard","hentry","category-munmonlisme","tag-date","tag-hwclock","tag-time"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p4NeyD-e0","jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/www.munmon.com\/v3\/wp-json\/wp\/v2\/posts\/868","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.munmon.com\/v3\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.munmon.com\/v3\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.munmon.com\/v3\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.munmon.com\/v3\/wp-json\/wp\/v2\/comments?post=868"}],"version-history":[{"count":0,"href":"https:\/\/www.munmon.com\/v3\/wp-json\/wp\/v2\/posts\/868\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.munmon.com\/v3\/wp-json\/wp\/v2\/media?parent=868"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.munmon.com\/v3\/wp-json\/wp\/v2\/categories?post=868"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.munmon.com\/v3\/wp-json\/wp\/v2\/tags?post=868"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}