
{"id":97009,"date":"2025-09-16T15:46:36","date_gmt":"2025-09-16T15:46:36","guid":{"rendered":"https:\/\/mycryptomania.com\/?p=97009"},"modified":"2025-09-16T15:46:36","modified_gmt":"2025-09-16T15:46:36","slug":"leap-seconds-time-in-solidity","status":"publish","type":"post","link":"https:\/\/mycryptomania.com\/?p=97009","title":{"rendered":"Leap Seconds &amp; Time in Solidity"},"content":{"rendered":"<p>Sometimes <a href=\"https:\/\/ethereum.stackexchange.com\/questions\/76015\/what-are-some-practical-considerations-for-leap-seconds\">concepts<\/a> we took for granted are <a href=\"https:\/\/medium.com\/solidified\/the-times-are-a-changing-a300ff960df\">challenged<\/a>. Did this happen to time recently?<\/p>\n<p><a href=\"https:\/\/www.scientificamerican.com\/article\/leap-seconds-may-be-abandoned-by-the-worlds-timekeepers\/\">Should We Abandon the Leap\u00a0Second?<\/a><\/p>\n<p><a href=\"https:\/\/medium.com\/solidified\/the-times-are-a-changing-a300ff960df\">Dealing<\/a> with dates and time is always tricky, and in Solidity there is no difference. <a href=\"https:\/\/medium.com\/solidified\/the-times-are-a-changing-a300ff960df\">Although<\/a> there are some keywords that help us like now and units like days or hours there are a few <a href=\"https:\/\/github.com\/yearn\/yearn-vaults\/pull\/215\">things<\/a> we have to keep in mind. You should <a href=\"https:\/\/betterprogramming.pub\/solidity-tutorial-all-about-time-units-b392324bea32\">also<\/a> keep in <a href=\"https:\/\/blog.finxter.com\/ether-and-time-units-and-globally-available-variables-in-solidity\/\">mind<\/a> that the EVM counts time in\u00a0seconds.<\/p>\n<p>Everything is a Unix <a href=\"https:\/\/betterprogramming.pub\/solidity-tutorial-all-about-time-units-b392324bea32?source=post_page-----9f806dcda79a--------------------------------\">timestamp<\/a>!<\/p>\n<p>In general, there are two <a href=\"https:\/\/ethereum.stackexchange.com\/questions\/68064\/what-is-the-time-zone-of-the-ethereum-block-chain\">options<\/a> to include a time factor into a Solidity contract: relating to the <a href=\"https:\/\/betterprogramming.pub\/solidity-tutorial-all-about-time-units-b392324bea32\">current<\/a> block number or <a href=\"https:\/\/mixbytes.io\/blog\/metamorphic-smart-contracts-is-evm-code-truly-immutable\">relating<\/a> to the current timestamp. There are also two <a href=\"https:\/\/mixbytes.io\/blog\/metamorphic-smart-contracts-is-evm-code-truly-immutable\">interesting<\/a> points, much thanks <a href=\"https:\/\/rsivakov.com\/\">Roman Sivakov<\/a> &amp; <a href=\"https:\/\/medium.com\/@banteg\">Banteg<\/a> for <a href=\"https:\/\/medium.com\/@BokkyPooBah\/bokkypoobahs-gas-efficient-solidity-datetime-library-92bf96d9b2da\">spotting<\/a> and bringing them up in a dev-chat:<\/p>\n<p><em>First, did you know that the future behavior of the Earth\u2019s rotation is unknown, so the UT1-UTC difference is unpredictable and can only be derived from <\/em><a href=\"https:\/\/medium.com\/@BokkyPooBah\/bokkypoobahs-gas-efficient-solidity-datetime-library-92bf96d9b2da\"><em>observations<\/em><\/a><em>?<\/em><em>Second, with very small <\/em><a href=\"https:\/\/www.scientificamerican.com\/article\/leap-seconds-may-be-abandoned-by-the-worlds-timekeepers\/\"><em>changes<\/em><\/a><em> in the angular velocity of the Earth\u2019s rotation, leap seconds can run up quite quickly, because a small change in angular velocity is multiplied by time, i.e., there is a cumulative effect. In <\/em><a href=\"https:\/\/hpiers.obspm.fr\/eop-pc\/\"><em>Paris<\/em><\/a><em>, by the way, there is a separate <\/em><a href=\"https:\/\/hpiers.obspm.fr\/eop-pc\/\"><em>department<\/em><\/a><em> that keeps an eye on the leap <\/em><a href=\"https:\/\/www.geeksforgeeks.org\/time-units-in-solidity\/?source=post_page-----9f806dcda79a--------------------------------\"><em>seconds<\/em><\/a><em>\u00a0issue!<\/em><\/p>\n<h4>Stay safe!<\/h4>\n<p><a href=\"https:\/\/medium.com\/coinmonks\/leap-seconds-time-in-solidity-0bb4d47eeb0b\">Leap Seconds &amp; Time in Solidity<\/a> was originally published in <a href=\"https:\/\/medium.com\/coinmonks\">Coinmonks<\/a> on Medium, where people are continuing the conversation by highlighting and responding to this story.<\/p>","protected":false},"excerpt":{"rendered":"<p>Sometimes concepts we took for granted are challenged. Did this happen to time recently? Should We Abandon the Leap\u00a0Second? Dealing with dates and time is always tricky, and in Solidity there is no difference. Although there are some keywords that help us like now and units like days or hours there are a few things [&hellip;]<\/p>\n","protected":false},"author":0,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-97009","post","type-post","status-publish","format-standard","hentry","category-interesting"],"_links":{"self":[{"href":"https:\/\/mycryptomania.com\/index.php?rest_route=\/wp\/v2\/posts\/97009"}],"collection":[{"href":"https:\/\/mycryptomania.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mycryptomania.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/mycryptomania.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=97009"}],"version-history":[{"count":0,"href":"https:\/\/mycryptomania.com\/index.php?rest_route=\/wp\/v2\/posts\/97009\/revisions"}],"wp:attachment":[{"href":"https:\/\/mycryptomania.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=97009"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mycryptomania.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=97009"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mycryptomania.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=97009"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}