| 93 | * @see SI#NANOSECONDS |
| 94 | */ |
| 95 | public final class MachineTime<U> |
| 96 | implements TimeSpan<U>, Comparable<MachineTime<U>>, Serializable { |
| 97 | |
| 98 | //~ Statische Felder/Initialisierungen -------------------------------- |
| 99 | |
| 100 | private static final int MRD = 1000000000; |
| 101 | |
| 102 | private static final MachineTime<TimeUnit> POSIX_ZERO = new MachineTime<>(0, 0, POSIX); |
| 103 | private static final MachineTime<SI> UTC_ZERO = new MachineTime<>(0, 0, UTC); |
| 104 | |
| 105 | /** |
| 106 | * Reversible metric on the POSIX scale (without leap seconds). |
| 107 | * |
| 108 | * @since 2.0 |
| 109 | */ |
| 110 | /*[deutsch] |
| 111 | * Umkehrbare Metrik auf der POSIX-Skala (ohne Schaltsekunden). |
| 112 | * |
| 113 | * @since 2.0 |
| 114 | */ |
| 115 | public static final TimeMetric<TimeUnit, MachineTime<TimeUnit>> ON_POSIX_SCALE = new Metric<>(POSIX); |
| 116 | |
| 117 | /** |
| 118 | * <p>Reversible metric on the UTC scale (inclusive leap seconds). </p> |
| 119 | * |
| 120 | * <p>Time points before 1972 are not supported. </p> |
| 121 | * |
| 122 | * @since 2.0 |
| 123 | */ |
| 124 | /*[deutsch] |
| 125 | * <p>Umkehrbare Metrik auf der UTC-Skala (inklusive Schaltsekunden). </p> |
| 126 | * |
| 127 | * <p>Zeitpunkte vor 1972 werden nicht unterstützt. </p> |
| 128 | * |
| 129 | * @since 2.0 |
| 130 | */ |
| 131 | public static final TimeMetric<TimeUnit, MachineTime<SI>> ON_UTC_SCALE = new Metric<>(UTC); |
| 132 | |
| 133 | private static final long serialVersionUID = -4150291820807606229L; |
| 134 | |
| 135 | //~ Instanzvariablen -------------------------------------------------- |
| 136 | |
| 137 | private transient final long seconds; |
| 138 | private transient final int nanos; |
| 139 | private transient final TimeScale scale; |
| 140 | |
| 141 | //~ Konstruktoren ----------------------------------------------------- |
| 142 | |
| 143 | private MachineTime( |
| 144 | long secs, |
| 145 | int fraction, |
| 146 | TimeScale scale |
| 147 | ) { |
| 148 | super(); |
| 149 | |
| 150 | while (fraction < 0) { |
| 151 | fraction += MRD; |
| 152 | secs = Math.subtractExact(secs, 1); |
nothing calls this directly
no outgoing calls
no test coverage detected