[DEV] remove deprecated echrono ==> use java clock and System.nano monotonic clock
This commit is contained in:
parent
b5722fe8e1
commit
ff07d48196
@ -16,7 +16,6 @@ open module org.atriasoft.ewol {
|
|||||||
exports org.atriasoft.ewol.widget;
|
exports org.atriasoft.ewol.widget;
|
||||||
//exports org.atriasoft.ewol.widget.meta;
|
//exports org.atriasoft.ewol.widget.meta;
|
||||||
|
|
||||||
exports org.atriasoft.echrono;
|
|
||||||
exports org.atriasoft.esignal;
|
exports org.atriasoft.esignal;
|
||||||
|
|
||||||
requires transitive org.atriasoft.iogami;
|
requires transitive org.atriasoft.iogami;
|
||||||
|
@ -1,42 +0,0 @@
|
|||||||
package org.atriasoft.echrono;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Clock is a compleate virtual clock that is used to virtualize the urrent clock used (can be non real-time, ex:for simulation)
|
|
||||||
*/
|
|
||||||
public class Clock {
|
|
||||||
public static Clock now() {
|
|
||||||
return new Clock(System.nanoTime());
|
|
||||||
}
|
|
||||||
|
|
||||||
private final long data; //!< virtual clock
|
|
||||||
|
|
||||||
public Clock() {
|
|
||||||
this.data = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Clock(final double val) { //value in second
|
|
||||||
this.data = (long) (val * 1000000000.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Clock(final int val) { //value in nanosecond
|
|
||||||
this.data = val;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Clock(final long val) { //value in nanosecond
|
|
||||||
this.data = val;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Clock(final long valSec, final long valNano) { //value in second and nanosecond
|
|
||||||
this.data = valSec * 1000000000L + valNano;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long get() {
|
|
||||||
return this.data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Duration less(final Clock timeUpAppl) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return new Duration(this.data - timeUpAppl.data);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,44 +0,0 @@
|
|||||||
package org.atriasoft.echrono;
|
|
||||||
|
|
||||||
public class Duration {
|
|
||||||
public static Duration milliseconds(final long milli) {
|
|
||||||
return new Duration(milli / 1000.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
private final long data; // stored in ns
|
|
||||||
|
|
||||||
public Duration() {
|
|
||||||
this.data = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Duration(final double val) { //value in second
|
|
||||||
this.data = (long) (val * 1000000000.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Duration(final int val) { //value in nanosecond
|
|
||||||
this.data = val;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Duration(final long val) { //value in nanosecond
|
|
||||||
this.data = val;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Duration(final long valSec, final long valNano) { //value in second and nanosecond
|
|
||||||
this.data = valSec * 1000000000L + valNano;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long get() {
|
|
||||||
return this.data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isGreaterThan(final Duration sepatateTime) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return this.data - sepatateTime.data > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float toSeconds() {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return (float) (this.data / 1000000000.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,41 +0,0 @@
|
|||||||
package org.atriasoft.echrono;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Steady is a Program start time clock
|
|
||||||
*/
|
|
||||||
public class Steady {
|
|
||||||
public static Steady now() {
|
|
||||||
return new Steady(System.nanoTime());
|
|
||||||
}
|
|
||||||
|
|
||||||
private final long data; //!< Monotonic clock since computer start (ns)
|
|
||||||
|
|
||||||
public Steady() {
|
|
||||||
this.data = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Steady(final double val) { //value in second
|
|
||||||
this.data = (long) (val * 1000000000.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Steady(final int val) { //value in nanosecond
|
|
||||||
this.data = val;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Steady(final long val) { //value in nanosecond
|
|
||||||
this.data = val;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Steady(final long valSec, final long valNano) { //value in second and nanosecond
|
|
||||||
this.data = valSec * 1000000000L + valNano;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long get() {
|
|
||||||
return this.data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Duration less(final Steady other) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return new Duration(this.data - other.data);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,40 +0,0 @@
|
|||||||
package org.atriasoft.echrono;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represent the earth clock (if computer is synchronized)
|
|
||||||
*/
|
|
||||||
public class Time {
|
|
||||||
public static Time now() {
|
|
||||||
return new Time(System.nanoTime());
|
|
||||||
}
|
|
||||||
|
|
||||||
private final long data; //!< earth time since Epock in ns
|
|
||||||
|
|
||||||
public Time() {
|
|
||||||
this.data = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Time(final double val) { //value in second
|
|
||||||
this.data = (long) (val * 1000000000.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Time(final int val) { //value in nanosecond
|
|
||||||
this.data = val;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Time(final long val) { //value in nanosecond
|
|
||||||
this.data = val;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Time(final long valSec, final long valNano) { //value in second and nanosecond
|
|
||||||
this.data = valSec * 1000000000L + valNano;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long get() {
|
|
||||||
return this.data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Clock toClock() {
|
|
||||||
return new Clock(this.data);
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user