0

We're running a Java 11 windows application on a Centos 8 using Wine 6.

When we made the switch from Wine 4 to 6 we saw that Instant.now started to return values in Millisecond accuracy instead of nanos/micros.

One of our developers at the time was able to trace it to a specific function in wine code and apply a patch to reverse it.

Unfortunately that developer is long gone, and so is the patch :( And unfortunately I've no idea how to trace that change my self.

Now we want to migrate to Wine 8 but when we do that we still suffer from that accuracy issue, our application is very latency sensitive and we rely on microseconds accuracy for measurement.

Is anyone else familiar with that problem and has any idea how to fix it? We're building Wine from source so I'm down with anything.

Or maybe we should use something other than Instant.now() that is more portable?

Tomer Arazy
  • 1,833
  • 10
  • 15
  • 2
    Don't use `Instant` for measurements. Use `System.nanoTime()` instead which is guaranteed to be chronologically strictly increasing (`Instant.now()` can go "backwards", i.e. the latter of two measurements can give you a time before the former). You will not necessarily get a better precision, but it's worth a try. https://stackoverflow.com/questions/351565/system-currenttimemillis-vs-system-nanotime compares the two – knittl Feb 28 '23 at 12:13
  • 1
    If you don't care about the actual time, but rather *time differences*, then you could use `System.nanoTime()`. – MC Emperor Feb 28 '23 at 12:13
  • You are confusing 'accuracy' with the number of digits in a value. – undefined symbol Feb 28 '23 at 13:10
  • I need the number of microseconds since epoch, at the moment we're using `ChronoUnit.MICROS.between(Instant.EPOCH, Instant.now())` – Tomer Arazy Feb 28 '23 at 13:28

0 Answers0