off-topic 2025-08-27

Interesting that we had Thread.sleep(long millis, int nanos) since JDK 11, which from the docs makes you assume that if your system supports it you have sub-milliseconds sleeps, but that doesn't work until JDK 21. Until that the minimum sleep is still 1ms (at least on Linux). Just got bitten by it.

out of curiosity, what did you use sub-ms sleep for?

some Software Defined Radio stuff

🆒 1

which was working fine until it wasn't, and I didn't understood why until I figured I had changed my current jdk

@jjttjj I uploaded a small demo some weeks ago https://www.youtube.com/watch?v=bV-amgLb-2Q in case you are interested

nice, I'll check it out later!

Getting sub millisecond sleeps can be annoying. I don't think most systems support it.

currently it works at least for my purpose on Linux with JDK >= 21

For really accurate sleeps, I ended up doing https://github.com/phronmophobic/clj-libretro/blob/9a155ff4117485171b390c35366bc97e9a57b720/src/com/phronemophobic/clj_libretro/ui.clj#L290. I also had to increase the priority for that thread.

This is on mac osx. Not sure if that is the best approach, but it worked for me.

oh interesting, thanks for sharing

oh, nice, never heard of that before