{"id":176,"date":"2013-09-17T12:35:01","date_gmt":"2013-09-17T10:35:01","guid":{"rendered":"http:\/\/catyellow.net\/blog\/?p=176"},"modified":"2013-09-17T12:35:01","modified_gmt":"2013-09-17T10:35:01","slug":"get-date-with-nanoseconds-on-macos","status":"publish","type":"post","link":"https:\/\/catyellow.net\/blog\/?p=176","title":{"rendered":"Get date with nanoseconds on MacOS"},"content":{"rendered":"<p>Recently I tried to run my own simple bash script (written on Linux) on my Mac and I found that results are bad because a &#8220;date&#8221; function.<\/p>\n<p>So the problem is &#8211; date on MacOS doesn&#8217;t have nanoseconds option.<\/p>\n<p><a href=\"http:\/\/stackoverflow.com\/questions\/9804966\/date-command-does-not-follow-linux-specifications-mac-os-x-lionhttp:\/\/\" title=\"Solution is simple\" target=\"_blank\">Solution is simple<\/a>: install &#8220;coreutils&#8221; from MacPorts<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n$ sudo port install coreutils\r\n<\/pre>\n<p>that&#8217;s it!<\/p>\n<p>Now GNU version of the date is available as gdate:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n$ gdate +%s%N\r\n1379413863366167000\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Recently I tried to run my own simple bash script (written on Linux) on my Mac and I found that results are bad because a &#8220;date&#8221; function. So the problem is &#8211; date on MacOS doesn&#8217;t have nanoseconds option. Solution is simple: install &#8220;coreutils&#8221; from MacPorts that&#8217;s it! Now GNU version of the date is [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[18,34],"_links":{"self":[{"href":"https:\/\/catyellow.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/176"}],"collection":[{"href":"https:\/\/catyellow.net\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/catyellow.net\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/catyellow.net\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/catyellow.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=176"}],"version-history":[{"count":3,"href":"https:\/\/catyellow.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/176\/revisions"}],"predecessor-version":[{"id":252,"href":"https:\/\/catyellow.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/176\/revisions\/252"}],"wp:attachment":[{"href":"https:\/\/catyellow.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=176"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/catyellow.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=176"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/catyellow.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=176"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}