<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Clojure Q&amp;A - Recent questions tagged time</title>
<link>https://ask.clojure.org/index.php/tag/time</link>
<description>Powered by Question2Answer</description>
<item>
<title>#inst printer uses a ThreadLocal SimpleDateFormat, which is inefficient with virtual threads</title>
<link>https://ask.clojure.org/index.php/13333/printer-threadlocal-simpledateformat-inefficient-virtual</link>
<description>&lt;p&gt;The #inst printer uses java.text.SimpleDateFormat, which is not thread-safe. As per common Java practice (of yesteryear), the instance used is folded into a proxied ThreadLocal so all access per thread is thread-safe but no synchronization is needed. In Java 21, this is not ideal because virtual threads are numerous and there is little reuse within a single virtual thread, as there would have been before in a pooled non-virtual thread.&lt;/p&gt;
&lt;p&gt;Instead, we should use the immutable formatter provided since Java 8 in java.time.format.DateTimeFormatter and not use a ThreadLocal for this.&lt;/p&gt;
</description>
<category>Printing</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13333/printer-threadlocal-simpledateformat-inefficient-virtual</guid>
<pubDate>Tue, 26 Sep 2023 21:11:41 +0000</pubDate>
</item>
<item>
<title>Get the difference of two numbers and print in its Value</title>
<link>https://ask.clojure.org/index.php/10596/get-the-difference-of-two-numbers-and-print-in-its-value</link>
<description>&lt;p&gt;Am trying to get the execution time of a function in clojure,so i decided to store the system nano time in variable called start and then after the method executes i get it and get the difference and print it out..Here is the code&lt;br&gt;
&lt;code&gt;
(def start(System/nanoTime))
;;there is some functional call here
(def end(System/nanoTime))
;;below i need code to print the difference of the two
(println &quot;The call took these nano seconds to execute&quot;)
&lt;/code&gt;&lt;/p&gt;
</description>
<category>Compiler</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/10596/get-the-difference-of-two-numbers-and-print-in-its-value</guid>
<pubDate>Wed, 12 May 2021 15:54:08 +0000</pubDate>
</item>
</channel>
</rss>