package o; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import java.io.InvalidObjectException; import java.io.ObjectStreamException; import java.io.Serializable; import org.threeten.bp.DateTimeException; import org.threeten.bp.OffsetDateTime; import org.threeten.bp.temporal.UnsupportedTemporalTypeException; /* renamed from: o.gss, reason: case insensitive filesystem */ /* loaded from: classes6.dex */ public final class C15523gss extends gtE implements InterfaceC15536gtL, gtJ, Comparable, Serializable { private static final long MILLIS_PER_SEC = 1000; private static final int NANOS_PER_MILLI = 1000000; private static final int NANOS_PER_SECOND = 1000000000; private static final long serialVersionUID = -665713676816604388L; private final int nanos; private final long seconds; public static final C15523gss EPOCH = new C15523gss(0, 0); private static final long MIN_SECOND = -31557014167219200L; public static final C15523gss MIN = ofEpochSecond(MIN_SECOND, 0); private static final long MAX_SECOND = 31556889864403199L; public static final C15523gss MAX = ofEpochSecond(MAX_SECOND, 999999999); public static final gtQ FROM = new gtQ() { // from class: o.gss.2 @Override // o.gtQ public final C15523gss queryFrom(gtK gtk) { return C15523gss.from(gtk); } }; public static C15523gss now() { return AbstractC15514gsj.systemUTC().instant(); } public static C15523gss now(AbstractC15514gsj abstractC15514gsj) { gtG.requireNonNull(abstractC15514gsj, "clock"); return abstractC15514gsj.instant(); } public static C15523gss ofEpochSecond(long j) { return create(j, 0); } public static C15523gss ofEpochSecond(long j, long j2) { return create(gtG.safeAdd(j, gtG.floorDiv(j2, 1000000000L)), gtG.floorMod(j2, 1000000000)); } public static C15523gss ofEpochMilli(long j) { return create(gtG.floorDiv(j, MILLIS_PER_SEC), gtG.floorMod(j, 1000) * NANOS_PER_MILLI); } public static C15523gss from(gtK gtk) { try { return ofEpochSecond(gtk.getLong(EnumC15534gtD.INSTANT_SECONDS), gtk.get(EnumC15534gtD.NANO_OF_SECOND)); } catch (DateTimeException e) { StringBuilder sb = new StringBuilder("Unable to obtain Instant from TemporalAccessor: "); sb.append(gtk); sb.append(", type "); sb.append(gtk.getClass().getName()); throw new DateTimeException(sb.toString(), e); } } public static C15523gss parse(CharSequence charSequence) { return (C15523gss) C15554gto.ISO_INSTANT.parse(charSequence, FROM); } private static C15523gss create(long j, int i) { if ((i | j) == 0) { return EPOCH; } if (j < MIN_SECOND || j > MAX_SECOND) { throw new DateTimeException("Instant exceeds minimum or maximum instant"); } return new C15523gss(j, i); } private C15523gss(long j, int i) { this.seconds = j; this.nanos = i; } @Override // o.gtK public final boolean isSupported(InterfaceC15537gtP interfaceC15537gtP) { return interfaceC15537gtP instanceof EnumC15534gtD ? interfaceC15537gtP == EnumC15534gtD.INSTANT_SECONDS || interfaceC15537gtP == EnumC15534gtD.NANO_OF_SECOND || interfaceC15537gtP == EnumC15534gtD.MICRO_OF_SECOND || interfaceC15537gtP == EnumC15534gtD.MILLI_OF_SECOND : interfaceC15537gtP != null && interfaceC15537gtP.isSupportedBy(this); } @Override // o.InterfaceC15536gtL public final boolean isSupported(InterfaceC15539gtV interfaceC15539gtV) { return interfaceC15539gtV instanceof gtH ? interfaceC15539gtV.isTimeBased() || interfaceC15539gtV == gtH.DAYS : interfaceC15539gtV != null && interfaceC15539gtV.isSupportedBy(this); } @Override // o.gtE, o.gtK public final gtT range(InterfaceC15537gtP interfaceC15537gtP) { return super.range(interfaceC15537gtP); } @Override // o.gtE, o.gtK public final int get(InterfaceC15537gtP interfaceC15537gtP) { if (interfaceC15537gtP instanceof EnumC15534gtD) { int i = AnonymousClass3.$SwitchMap$org$threeten$bp$temporal$ChronoField[((EnumC15534gtD) interfaceC15537gtP).ordinal()]; if (i == 1) { return this.nanos; } if (i == 2) { return this.nanos / 1000; } if (i == 3) { return this.nanos / NANOS_PER_MILLI; } throw new UnsupportedTemporalTypeException("Unsupported field: ".concat(String.valueOf(interfaceC15537gtP))); } return range(interfaceC15537gtP).checkValidIntValue(interfaceC15537gtP.getFrom(this), interfaceC15537gtP); } @Override // o.gtK public final long getLong(InterfaceC15537gtP interfaceC15537gtP) { int i; if (interfaceC15537gtP instanceof EnumC15534gtD) { int i2 = AnonymousClass3.$SwitchMap$org$threeten$bp$temporal$ChronoField[((EnumC15534gtD) interfaceC15537gtP).ordinal()]; if (i2 == 1) { i = this.nanos; } else if (i2 == 2) { i = this.nanos / 1000; } else { if (i2 != 3) { if (i2 == 4) { return this.seconds; } throw new UnsupportedTemporalTypeException("Unsupported field: ".concat(String.valueOf(interfaceC15537gtP))); } i = this.nanos / NANOS_PER_MILLI; } return i; } return interfaceC15537gtP.getFrom(this); } @Override // o.InterfaceC15536gtL public final C15523gss with(gtJ gtj) { return (C15523gss) gtj.adjustInto(this); } @Override // o.InterfaceC15536gtL public final C15523gss with(InterfaceC15537gtP interfaceC15537gtP, long j) { if (interfaceC15537gtP instanceof EnumC15534gtD) { EnumC15534gtD enumC15534gtD = (EnumC15534gtD) interfaceC15537gtP; enumC15534gtD.checkValidValue(j); int i = AnonymousClass3.$SwitchMap$org$threeten$bp$temporal$ChronoField[enumC15534gtD.ordinal()]; if (i == 1) { return j != ((long) this.nanos) ? create(this.seconds, (int) j) : this; } if (i == 2) { int i2 = ((int) j) * 1000; return i2 != this.nanos ? create(this.seconds, i2) : this; } if (i == 3) { int i3 = ((int) j) * NANOS_PER_MILLI; return i3 != this.nanos ? create(this.seconds, i3) : this; } if (i == 4) { return j != this.seconds ? create(j, this.nanos) : this; } throw new UnsupportedTemporalTypeException("Unsupported field: ".concat(String.valueOf(interfaceC15537gtP))); } return (C15523gss) interfaceC15537gtP.adjustInto(this, j); } public final C15523gss truncatedTo(InterfaceC15539gtV interfaceC15539gtV) { if (interfaceC15539gtV == gtH.NANOS) { return this; } C15519gso duration = interfaceC15539gtV.getDuration(); if (duration.getSeconds() > 86400) { throw new DateTimeException("Unit is too large to be used for truncation"); } long nanos = duration.toNanos(); if (86400000000000L % nanos != 0) { throw new DateTimeException("Unit must divide into a standard day without remainder"); } long j = ((this.seconds % 86400) * 1000000000) + this.nanos; return plusNanos((gtG.floorDiv(j, nanos) * nanos) - j); } @Override // o.InterfaceC15536gtL public final C15523gss plus(gtN gtn) { return (C15523gss) gtn.addTo(this); } /* JADX INFO: Access modifiers changed from: package-private */ /* renamed from: o.gss$3, reason: invalid class name */ /* loaded from: classes6.dex */ public static /* synthetic */ class AnonymousClass3 { static final int[] $SwitchMap$org$threeten$bp$temporal$ChronoField; static final int[] $SwitchMap$org$threeten$bp$temporal$ChronoUnit; static { int[] iArr = new int[gtH.values().length]; $SwitchMap$org$threeten$bp$temporal$ChronoUnit = iArr; try { iArr[gtH.NANOS.ordinal()] = 1; } catch (NoSuchFieldError unused) { } try { $SwitchMap$org$threeten$bp$temporal$ChronoUnit[gtH.MICROS.ordinal()] = 2; } catch (NoSuchFieldError unused2) { } try { $SwitchMap$org$threeten$bp$temporal$ChronoUnit[gtH.MILLIS.ordinal()] = 3; } catch (NoSuchFieldError unused3) { } try { $SwitchMap$org$threeten$bp$temporal$ChronoUnit[gtH.SECONDS.ordinal()] = 4; } catch (NoSuchFieldError unused4) { } try { $SwitchMap$org$threeten$bp$temporal$ChronoUnit[gtH.MINUTES.ordinal()] = 5; } catch (NoSuchFieldError unused5) { } try { $SwitchMap$org$threeten$bp$temporal$ChronoUnit[gtH.HOURS.ordinal()] = 6; } catch (NoSuchFieldError unused6) { } try { $SwitchMap$org$threeten$bp$temporal$ChronoUnit[gtH.HALF_DAYS.ordinal()] = 7; } catch (NoSuchFieldError unused7) { } try { $SwitchMap$org$threeten$bp$temporal$ChronoUnit[gtH.DAYS.ordinal()] = 8; } catch (NoSuchFieldError unused8) { } int[] iArr2 = new int[EnumC15534gtD.values().length]; $SwitchMap$org$threeten$bp$temporal$ChronoField = iArr2; try { iArr2[EnumC15534gtD.NANO_OF_SECOND.ordinal()] = 1; } catch (NoSuchFieldError unused9) { } try { $SwitchMap$org$threeten$bp$temporal$ChronoField[EnumC15534gtD.MICRO_OF_SECOND.ordinal()] = 2; } catch (NoSuchFieldError unused10) { } try { $SwitchMap$org$threeten$bp$temporal$ChronoField[EnumC15534gtD.MILLI_OF_SECOND.ordinal()] = 3; } catch (NoSuchFieldError unused11) { } try { $SwitchMap$org$threeten$bp$temporal$ChronoField[EnumC15534gtD.INSTANT_SECONDS.ordinal()] = 4; } catch (NoSuchFieldError unused12) { } } } @Override // o.InterfaceC15536gtL public final C15523gss plus(long j, InterfaceC15539gtV interfaceC15539gtV) { if (interfaceC15539gtV instanceof gtH) { switch (AnonymousClass3.$SwitchMap$org$threeten$bp$temporal$ChronoUnit[((gtH) interfaceC15539gtV).ordinal()]) { case 1: return plusNanos(j); case 2: return plus(j / 1000000, (j % 1000000) * MILLIS_PER_SEC); case 3: return plusMillis(j); case 4: return plusSeconds(j); case 5: return plusSeconds(gtG.safeMultiply(j, 60)); case 6: return plusSeconds(gtG.safeMultiply(j, 3600)); case 7: return plusSeconds(gtG.safeMultiply(j, 43200)); case 8: return plusSeconds(gtG.safeMultiply(j, 86400)); default: throw new UnsupportedTemporalTypeException("Unsupported unit: ".concat(String.valueOf(interfaceC15539gtV))); } } return (C15523gss) interfaceC15539gtV.addTo(this, j); } public final C15523gss plusSeconds(long j) { return plus(j, 0L); } public final C15523gss plusMillis(long j) { return plus(j / MILLIS_PER_SEC, (j % MILLIS_PER_SEC) * 1000000); } public final C15523gss plusNanos(long j) { return plus(0L, j); } private C15523gss plus(long j, long j2) { return (j | j2) == 0 ? this : ofEpochSecond(gtG.safeAdd(gtG.safeAdd(this.seconds, j), j2 / 1000000000), this.nanos + (j2 % 1000000000)); } @Override // o.InterfaceC15536gtL public final C15523gss minus(gtN gtn) { return (C15523gss) gtn.subtractFrom(this); } @Override // o.InterfaceC15536gtL public final C15523gss minus(long j, InterfaceC15539gtV interfaceC15539gtV) { return j == Long.MIN_VALUE ? plus(Long.MAX_VALUE, interfaceC15539gtV).plus(1L, interfaceC15539gtV) : plus(-j, interfaceC15539gtV); } public final C15523gss minusSeconds(long j) { if (j == Long.MIN_VALUE) { return plusSeconds(Long.MAX_VALUE).plusSeconds(1L); } return plusSeconds(-j); } public final C15523gss minusMillis(long j) { if (j == Long.MIN_VALUE) { return plusMillis(Long.MAX_VALUE).plusMillis(1L); } return plusMillis(-j); } public final C15523gss minusNanos(long j) { if (j == Long.MIN_VALUE) { return plusNanos(Long.MAX_VALUE).plusNanos(1L); } return plusNanos(-j); } @Override // o.gtE, o.gtK public final R query(gtQ gtq) { if (gtq == gtM.precision()) { return (R) gtH.NANOS; } if (gtq == gtM.localDate() || gtq == gtM.localTime() || gtq == gtM.chronology() || gtq == gtM.zoneId() || gtq == gtM.zone() || gtq == gtM.offset()) { return null; } return gtq.queryFrom(this); } @Override // o.gtJ public final InterfaceC15536gtL adjustInto(InterfaceC15536gtL interfaceC15536gtL) { return interfaceC15536gtL.with(EnumC15534gtD.INSTANT_SECONDS, this.seconds).with(EnumC15534gtD.NANO_OF_SECOND, this.nanos); } @Override // o.InterfaceC15536gtL public final long until(InterfaceC15536gtL interfaceC15536gtL, InterfaceC15539gtV interfaceC15539gtV) { C15523gss from = from(interfaceC15536gtL); if (interfaceC15539gtV instanceof gtH) { switch (AnonymousClass3.$SwitchMap$org$threeten$bp$temporal$ChronoUnit[((gtH) interfaceC15539gtV).ordinal()]) { case 1: return nanosUntil(from); case 2: return nanosUntil(from) / MILLIS_PER_SEC; case 3: return gtG.safeSubtract(from.toEpochMilli(), toEpochMilli()); case 4: return secondsUntil(from); case 5: return secondsUntil(from) / 60; case 6: return secondsUntil(from) / 3600; case 7: return secondsUntil(from) / 43200; case 8: return secondsUntil(from) / 86400; default: throw new UnsupportedTemporalTypeException("Unsupported unit: ".concat(String.valueOf(interfaceC15539gtV))); } } return interfaceC15539gtV.between(this, from); } private long nanosUntil(C15523gss c15523gss) { return gtG.safeAdd(gtG.safeMultiply(gtG.safeSubtract(c15523gss.seconds, this.seconds), 1000000000), c15523gss.nanos - this.nanos); } private long secondsUntil(C15523gss c15523gss) { long safeSubtract = gtG.safeSubtract(c15523gss.seconds, this.seconds); long j = c15523gss.nanos - this.nanos; return (safeSubtract <= 0 || j >= 0) ? (safeSubtract >= 0 || j <= 0) ? safeSubtract : safeSubtract + 1 : safeSubtract - 1; } public final OffsetDateTime atOffset(gsI gsi) { return OffsetDateTime.ofInstant(this, gsi); } public final gsN atZone(AbstractC15502gsH abstractC15502gsH) { return gsN.ofInstant(this, abstractC15502gsH); } public final long toEpochMilli() { long j = this.seconds; if (j >= 0) { return gtG.safeAdd(gtG.safeMultiply(j, MILLIS_PER_SEC), this.nanos / NANOS_PER_MILLI); } return gtG.safeSubtract(gtG.safeMultiply(j + 1, MILLIS_PER_SEC), MILLIS_PER_SEC - (this.nanos / NANOS_PER_MILLI)); } @Override // java.lang.Comparable public final int compareTo(C15523gss c15523gss) { int compareLongs = gtG.compareLongs(this.seconds, c15523gss.seconds); return compareLongs != 0 ? compareLongs : this.nanos - c15523gss.nanos; } public final boolean isAfter(C15523gss c15523gss) { return compareTo(c15523gss) > 0; } public final boolean isBefore(C15523gss c15523gss) { return compareTo(c15523gss) < 0; } public final boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof C15523gss)) { return false; } C15523gss c15523gss = (C15523gss) obj; return this.seconds == c15523gss.seconds && this.nanos == c15523gss.nanos; } public final String toString() { return C15554gto.ISO_INSTANT.format(this); } private Object writeReplace() { return new C15501gsD((byte) 2, this); } private Object readResolve() throws ObjectStreamException { throw new InvalidObjectException("Deserialization via serialization delegate"); } /* JADX INFO: Access modifiers changed from: package-private */ public final void writeExternal(DataOutput dataOutput) throws IOException { dataOutput.writeLong(this.seconds); dataOutput.writeInt(this.nanos); } /* JADX INFO: Access modifiers changed from: package-private */ public static C15523gss readExternal(DataInput dataInput) throws IOException { return ofEpochSecond(dataInput.readLong(), dataInput.readInt()); } public final int hashCode() { long j = this.seconds; return ((int) (j ^ (j >>> 32))) + (this.nanos * 51); } public final int getNano() { return this.nanos; } public final long getEpochSecond() { return this.seconds; } }