<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Duration on rustbites</title><link>https://www.rustbites.com/tags/duration/</link><description>Recent content in Duration on rustbites</description><generator>Hugo</generator><language>en</language><lastBuildDate>Mon, 18 May 2026 08:00:41 +0200</lastBuildDate><atom:link href="https://www.rustbites.com/tags/duration/index.xml" rel="self" type="application/rss+xml"/><item><title>145. Duration::from_nanos_u128 — Round-Trip Nanoseconds Without the u64 Cast</title><link>https://www.rustbites.com/posts/bite-145/</link><pubDate>Sun, 17 May 2026 17:00:00 +0100</pubDate><guid>https://www.rustbites.com/posts/bite-145/</guid><description>&lt;p&gt;&lt;code&gt;Duration::as_nanos()&lt;/code&gt; hands you a &lt;code&gt;u128&lt;/code&gt;. &lt;code&gt;Duration::from_nanos()&lt;/code&gt; takes a &lt;code&gt;u64&lt;/code&gt;. You feed one into the other and the compiler yells at you — or worse, you cast and quietly truncate at 584 years. Rust 1.93 closed the loop with &lt;code&gt;from_nanos_u128&lt;/code&gt;.&lt;/p&gt;</description></item></channel></rss>