I have some output from a (C ++) application that stores the tickcount value in a type that wraps to zero at 2 33 . (8 589 934 592) (do not have a code)
I need to write my own output in the same way. I extract the checkmark from C lib via JNA, but if I store it in int, it wraps up to -2 31 (-2,147,483,648) after ~ 25 days mark and if I store it in long it just keeps going past 2 33 .
How can I save (or write) a value in Java so that it wraps (to zero) at 2 33 ?
(preferably JRE7- and JRE8- on Win32- and Win64- and Linux-compatible solutions)
To get a checkmark, I use the following:
import com.sun.jna.*; public interface Kernel32 extends Library { Kernel32 INSTANCE = (Kernel32) Native.loadLibrary((Platform.isWindows() ? "kernel32" : "c"), Kernel32.class); Long GetTickCount(); } public interface Clib extends Library { Clib INSTANCE = (Clib) Native.loadLibrary((Platform.isWindows() ? "kernel32" : "c"), Clib.class); Long clock(); }
source share