MCPcopy Create free account
hub / github.com/MenoData/Time4J / transformForParse

Method transformForParse

base/src/main/java/net/time4j/Moment.java:2091–2131  ·  view source on GitHub ↗
(TimeScale scale)

Source from the content-addressed store, hash-verified

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,

Callers 1

createFromMethod · 0.95

Calls 3

isLeapSecondMethod · 0.95
getNanosecondMethod · 0.95
nameMethod · 0.65

Tested by

no test coverage detected