(TimeScale scale)
| 2047 | } |
| 2048 | |
| 2049 | private Moment transformForPrint(TimeScale scale) { |
| 2050 | |
| 2051 | switch (scale) { |
| 2052 | case POSIX: |
| 2053 | if (this.isLeapSecond()) { |
| 2054 | return new Moment( |
| 2055 | this.getNanosecond(), |
| 2056 | this.posixTime |
| 2057 | ); |
| 2058 | } else { |
| 2059 | return this; |
| 2060 | } |
| 2061 | case UTC: |
| 2062 | return this; |
| 2063 | case TAI: |
| 2064 | return new Moment( |
| 2065 | this.getNanosecond(scale), |
| 2066 | Math.addExact( |
| 2067 | this.getElapsedTime(scale), |
| 2068 | POSIX_UTC_DELTA - UTC_TAI_DELTA) |
| 2069 | ); |
| 2070 | case TT: |
| 2071 | case UT: |
| 2072 | return new Moment( |
| 2073 | this.getNanosecond(scale), |
| 2074 | Math.addExact( |
| 2075 | this.getElapsedTime(scale), |
| 2076 | POSIX_UTC_DELTA) |
| 2077 | ); |
| 2078 | case GPS: |
| 2079 | return new Moment( |
| 2080 | this.getNanosecond(), |
| 2081 | Math.addExact( |
| 2082 | this.getElapsedTime(GPS), |
| 2083 | POSIX_GPS_DELTA) |
| 2084 | ); |
| 2085 | default: |
| 2086 | throw new UnsupportedOperationException(scale.name()); |
| 2087 | } |
| 2088 | |
| 2089 | } |
| 2090 | |
| 2091 | private Moment transformForParse(TimeScale scale) { |
| 2092 |
no test coverage detected