{"id":1442,"date":"2021-09-21T16:51:40","date_gmt":"2021-09-21T15:51:40","guid":{"rendered":"https:\/\/coding.moris.org\/?p=1442"},"modified":"2021-09-23T20:26:33","modified_gmt":"2021-09-23T19:26:33","slug":"trap-with-gmtime-and-other-time-functions","status":"publish","type":"post","link":"https:\/\/priscimon.net\/coding\/2021\/09\/21\/trap-with-gmtime-and-other-time-functions\/","title":{"rendered":"Trap with `gmtime` and other time functions"},"content":{"rendered":"\n<p>From <code>man gmtime<\/code>:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>The <code>gmtime()<\/code> function converts the calendar time timep to broken-down time representation, expressed in Coordinated Universal Time (UTC). It may return <code>NULL<\/code> when the year does not fit into an integer. <strong><em>The return value points to a statically allocated struct which might be overwritten by subsequent calls to any of the date and time functions<\/em>.<\/strong> The <code>gmtime_r()<\/code> function does the same, but stores the data in a user-supplied struct.<\/p><\/blockquote>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>From man gmtime: The gmtime() function converts the calendar time timep to broken-down time representation, expressed in Coordinated Universal Time (UTC). It may return NULL when the year does not fit into an integer. The return value points to a statically allocated struct which might be overwritten by subsequent calls to any of the date [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":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":""},"categories":[1],"tags":[],"class_list":["post-1442","post","type-post","status-publish","format-standard","hentry","category-general"],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p3I4g9-ng","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/priscimon.net\/coding\/wp-json\/wp\/v2\/posts\/1442","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/priscimon.net\/coding\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/priscimon.net\/coding\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/priscimon.net\/coding\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/priscimon.net\/coding\/wp-json\/wp\/v2\/comments?post=1442"}],"version-history":[{"count":4,"href":"https:\/\/priscimon.net\/coding\/wp-json\/wp\/v2\/posts\/1442\/revisions"}],"predecessor-version":[{"id":1446,"href":"https:\/\/priscimon.net\/coding\/wp-json\/wp\/v2\/posts\/1442\/revisions\/1446"}],"wp:attachment":[{"href":"https:\/\/priscimon.net\/coding\/wp-json\/wp\/v2\/media?parent=1442"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/priscimon.net\/coding\/wp-json\/wp\/v2\/categories?post=1442"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/priscimon.net\/coding\/wp-json\/wp\/v2\/tags?post=1442"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}