/** * Returns the current timestamp with microsecond precision * via a system call to {@code gettimeofday}, through JNR C library. * * @return the current timestamp with microsecond precision. * @throws UnsupportedOperationException if JNR C library is not loaded or {@code gettimeofday} is not available. * @throws IllegalStateException if the call to {@code gettimeofday} did not complete with return code 0. */ public static long currentTimeMicros() { if (!isGettimeofdayAvailable()) throw new UnsupportedOperationException("JNR C library not loaded or gettimeofday not available"); LibCLoader.Timeval tv = new LibCLoader.Timeval(LibCLoader.LIB_C_RUNTIME); int res = LibCLoader.LIB_C.gettimeofday(tv, null); if (res != 0) throw new IllegalStateException("Call to gettimeofday failed with result " + res); return tv.tv_sec.get() * 1000000 + tv.tv_usec.get(); }
protected FuseFileInfo(jnr.ffi.Runtime runtime) { super(runtime); if(!Platform.IS_WINDOWS) { flags = new Signed32(); fh_old = new UnsignedLong(); direct_io = new Padding(NativeType.UCHAR, 1); keep_cache = new Padding(NativeType.UCHAR, 1); flush = new Padding(NativeType.UCHAR, 1); nonseekable = new Padding(NativeType.UCHAR, 1); flock_release = new Padding(NativeType.UCHAR, 1); padding = new Padding(NativeType.UCHAR, 3); fh = new u_int64_t(); lock_owner = new u_int64_t(); } else { flags = new Signed32(); fh_old = new Unsigned32(); new Signed32(); // writepage direct_io = new Padding(NativeType.UCHAR, 1); keep_cache = new Padding(NativeType.UCHAR, 1); flush = new Padding(NativeType.UCHAR, 1); nonseekable = new Padding(NativeType.UCHAR, 1); flock_release = new Padding(NativeType.UCHAR, 0); padding = new Padding(NativeType.UCHAR, 0); fh = new u_int64_t(); lock_owner = new u_int64_t(); } }
protected FuseFileInfo(jnr.ffi.Runtime runtime) { super(runtime); if(!Platform.IS_WINDOWS) { flags = new Signed32(); fh_old = new UnsignedLong(); direct_io = new Padding(NativeType.UCHAR, 1); keep_cache = new Padding(NativeType.UCHAR, 1); flush = new Padding(NativeType.UCHAR, 1); nonseekable = new Padding(NativeType.UCHAR, 1); flock_release = new Padding(NativeType.UCHAR, 1); padding = new Padding(NativeType.UCHAR, 3); fh = new u_int64_t(); lock_owner = new u_int64_t(); } else { flags = new Signed32(); fh_old = new Unsigned32(); new Signed32(); // writepage direct_io = new Padding(NativeType.UCHAR, 1); keep_cache = new Padding(NativeType.UCHAR, 1); flush = new Padding(NativeType.UCHAR, 1); nonseekable = new Padding(NativeType.UCHAR, 1); flock_release = new Padding(NativeType.UCHAR, 0); padding = new Padding(NativeType.UCHAR, 0); fh = new u_int64_t(); lock_owner = new u_int64_t(); } }
/** * Returns the current timestamp with microsecond precision * via a system call to {@code gettimeofday}, through JNR C library. * * @return the current timestamp with microsecond precision. * @throws UnsupportedOperationException if JNR C library is not loaded or {@code gettimeofday} is not available. * @throws IllegalStateException if the call to {@code gettimeofday} did not complete with return code 0. */ public static long currentTimeMicros() { if (!isGettimeofdayAvailable()) throw new UnsupportedOperationException("JNR C library not loaded or gettimeofday not available"); LibCLoader.Timeval tv = new LibCLoader.Timeval(LibCLoader.LIB_C_RUNTIME); int res = LibCLoader.LIB_C.gettimeofday(tv, null); if (res != 0) throw new IllegalStateException("Call to gettimeofday failed with result " + res); return tv.tv_sec.get() * 1000000 + tv.tv_usec.get(); }
/** * The current time in microseconds, as returned by libc.gettimeofday(); can only be used if * {@link #isCurrentTimeMicrosAvailable()} is true. */ public static long currentTimeMicros() { if (!isCurrentTimeMicrosAvailable()) { throw new IllegalStateException( "Native call not available. " + "Check isCurrentTimeMicrosAvailable() before calling this method."); } LibCLoader.Timeval tv = new LibCLoader.Timeval(LibCLoader.LIB_C_RUNTIME); int res = LibCLoader.LIB_C.gettimeofday(tv, null); if (res != 0) { throw new IllegalStateException("Call to libc.gettimeofday() failed with result " + res); } return tv.tv_sec.get() * 1000000 + tv.tv_usec.get(); }
/** * * @param unixEpochIn100ns epoch time in 100-ns precision * @return associated FILETIME structure */ private FileTime unixTimeToFileTime(long unixEpochIn100ns) { // FILETIME is a 64-bit unsigned integer representing // the number of 100-nanosecond intervals since January 1, 1601 // UNIX timestamp is number of seconds since January 1, 1970 // 116444736000000000 = 10_000_000 * 60 * 60 * 24 * 365 * 369 + 89 leap days long ft = 116444736000000000L + unixEpochIn100ns; //long ft = CommonFileInformation.asNanoSeconds(unixTimeSeconds); FileTime fileTime = new FileTime(getRuntime()); fileTime.dwLowDateTime.set(ft & 0xFFFFFFFFL); fileTime.dwHighDateTime.set((ft >> 32) & 0xFFFFFFFFL); return fileTime; }
/** * Returns the current timestamp with microsecond precision * via a system call to {@code gettimeofday}, through JNR C library. * * @return the current timestamp with microsecond precision. * @throws UnsupportedOperationException if JNR C library is not loaded or {@code gettimeofday} is not available. * @throws IllegalStateException if the call to {@code gettimeofday} did not complete with return code 0. */ public static long currentTimeMicros() { if (!isGettimeofdayAvailable()) throw new UnsupportedOperationException("JNR C library not loaded or gettimeofday not available"); LibCLoader.Timeval tv = new LibCLoader.Timeval(LibCLoader.LIB_C_RUNTIME); int res = LibCLoader.LIB_C.gettimeofday(tv, null); if (res != 0) throw new IllegalStateException("Call to gettimeofday failed with result " + res); return tv.tv_sec.get() * 1000000 + tv.tv_usec.get(); }
public int getHighDateTime() { return highDateTime.intValue(); }
public int getLowDateTime() { return lowDateTime.intValue(); }
public long getFileSizeHigh() { return nFileSizeHigh.intValue(); }
public int getFileAttributes() { return dwFileAttributes.intValue(); }
/** * Creates an array of <tt>Unsigned32</tt> instances. * * @param array the array to store the instances in * @return the array that was passed in */ protected final Unsigned32[] array(Unsigned32[] array) { arrayBegin(); for (int i = 0; i < array.length; ++i) { array[i] = new Unsigned32(); } arrayEnd(); return array; }
/** * Creates an array of <tt>Unsigned32</tt> instances. * * @param array the array to store the instances in * @return the array that was passed in */ protected final Unsigned32[] array(Unsigned32[] array) { arrayBegin(); for (int i = 0; i < array.length; ++i) { array[i] = new Unsigned32(); } arrayEnd(); return array; }
public int getHighDateTime() { return highDateTime.intValue(); }
public void setFlags(int value) { dwFlags.set(value); }
public int getLowDateTime() { return lowDateTime.intValue(); }
public long getFileSizeHigh() { return nFileSizeHigh.intValue(); }
public long getLength() { return length.get(); }
public void setFlags(int value) { dwFlags.set(value); }