(TimeScale scale)
| 2089 | } |
| 2090 | |
| 2091 | private Moment transformForParse(TimeScale scale) { |
| 2092 | |
| 2093 | if (scale == UTC) { |
| 2094 | return this; |
| 2095 | } else if (this.isLeapSecond()) { |
| 2096 | throw new IllegalArgumentException("Leap seconds do not exist on continuous time scale: " + scale); |
| 2097 | } |
| 2098 | |
| 2099 | switch (scale) { |
| 2100 | case POSIX: |
| 2101 | return this; |
| 2102 | case TAI: |
| 2103 | return new Moment( |
| 2104 | Math.subtractExact( |
| 2105 | this.posixTime, |
| 2106 | POSIX_UTC_DELTA - UTC_TAI_DELTA), |
| 2107 | this.getNanosecond(), |
| 2108 | scale |
| 2109 | ); |
| 2110 | case TT: |
| 2111 | case UT: |
| 2112 | return new Moment( |
| 2113 | Math.subtractExact( |
| 2114 | this.posixTime, |
| 2115 | POSIX_UTC_DELTA), |
| 2116 | this.getNanosecond(), |
| 2117 | scale |
| 2118 | ); |
| 2119 | case GPS: |
| 2120 | return new Moment( |
| 2121 | Math.subtractExact( |
| 2122 | this.posixTime, |
| 2123 | POSIX_GPS_DELTA), |
| 2124 | this.getNanosecond(), |
| 2125 | scale |
| 2126 | ); |
| 2127 | default: |
| 2128 | throw new UnsupportedOperationException(scale.name()); |
| 2129 | } |
| 2130 | |
| 2131 | } |
| 2132 | |
| 2133 | private static void format( |
| 2134 | int value, |
no test coverage detected