{"id":42312,"date":"2024-03-01T14:19:27","date_gmt":"2024-03-01T19:19:27","guid":{"rendered":"https:\/\/mjtsai.com\/blog\/?p=42312"},"modified":"2024-03-01T14:21:12","modified_gmt":"2024-03-01T19:21:12","slug":"time-1-0-0-swift-package","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2024\/03\/01\/time-1-0-0-swift-package\/","title":{"rendered":"Time 1.0.0 Swift Package"},"content":{"rendered":"<p><a href=\"https:\/\/forums.swift.org\/t\/announcing-time-1-0-0-type-safe-calendar-calculations\/70366\">Dave DeLong<\/a>:<\/p>\n<blockquote cite=\"https:\/\/forums.swift.org\/t\/announcing-time-1-0-0-type-safe-calendar-calculations\/70366\"><p><a href=\"https:\/\/forums.swift.org\/t\/introducing-time\/34196\">Four years ago<\/a> I introduced <strong>Time<\/strong> 0.9.0. It is appropriate that today, on its first birthday, it finally graduates to <code>1.0.0<\/code>!<\/p><p>[&#8230;]<\/p><p>All &ldquo;fixed values&rdquo; keep track of their calendar, locale, and time zone, enabling you to easily work with calendar values from around the world with the knowledge that their relative calculations are correct.<\/p><p>Beyond this, <strong>Time<\/strong> has numerous other capabilities, including:<\/p><ul><li>Creating clocks in any combination of calendar, locale, or time zone<\/li><li>Creating clocks that move faster or slower than real time to facilitate testing time-dependent code<\/li><li>Adopting the <code>RegionalClock<\/code> protocol to create your own clocks for controlling time<\/li><li>Listening for time changes via a Combine publisher or AsyncSequence<\/li><li>Retrieving the <code>Range&lt;Instant&gt;<\/code> for any calendar value<\/li><li>Converting calendar values between time zones, locales, and calendars<\/li><li>Truncating calendar values to get their containing units<\/li><li>Finding differences between calendar values<\/li><li>Offsetting (adjusting) calendar values by specific amounts<\/li><\/ul><\/blockquote>\n<p>It&rsquo;s built on Foundation.<\/p>\n\n<p><a href=\"https:\/\/mastodon.social\/@davedelong\/112016141833259438\">Dave DeLong<\/a>:<\/p>\n<blockquote cite=\"https:\/\/mastodon.social\/@davedelong\/112016141833259438\"><p>Well, the main reason for the delay is that I was working at Apple, where it&rsquo;s <em>extremely<\/em> difficult to get permission to work on open source projects. I left that job about 3 weeks ago, so the past couple of weeks have been me frantically getting the 1.0 version ready for today.<\/p><\/blockquote>\n\n<p>Previously:<\/p>\n<ul>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2024\/03\/01\/leap-year-bugs\/\">Leap Year Bugs<\/a><\/li>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2020\/03\/02\/time-swift-package\/\">&ldquo;Time&rdquo; Swift Package<\/a><\/li>\n<\/ul>","protected":false},"excerpt":{"rendered":"<p>Dave DeLong: Four years ago I introduced Time 0.9.0. It is appropriate that today, on its first birthday, it finally graduates to 1.0.0![&#8230;]All &ldquo;fixed values&rdquo; keep track of their calendar, locale, and time zone, enabling you to easily work with calendar values from around the world with the knowledge that their relative calculations are correct.Beyond [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"2024-03-01T19:19:30Z","apple_news_api_id":"392f9bcc-5c1e-489a-aa76-e7796583b130","apple_news_api_modified_at":"2024-03-01T19:19:50Z","apple_news_api_revision":"AAAAAAAAAAAAAAAAAAAAAA==","apple_news_api_share_url":"https:\/\/apple.news\/AOS-bzFweSJqqdud5ZYOxMA","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[4],"tags":[38,69,1813,74,991,71,2200,901,364,251],"class_list":["post-42312","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-apple","tag-cocoa","tag-combine-framework","tag-opensource","tag-open-source-software","tag-programming","tag-swift-concurrency","tag-swift-programming-language","tag-time","tag-working"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/42312","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=42312"}],"version-history":[{"count":2,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/42312\/revisions"}],"predecessor-version":[{"id":42316,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/42312\/revisions\/42316"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=42312"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=42312"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=42312"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}