181 lines
6.0 KiB
Java
181 lines
6.0 KiB
Java
package com.google.android.gms.internal.firebase_ml;
|
|
|
|
import java.io.Serializable;
|
|
import java.util.Arrays;
|
|
import java.util.GregorianCalendar;
|
|
import java.util.TimeZone;
|
|
import java.util.regex.Matcher;
|
|
import java.util.regex.Pattern;
|
|
import org.bouncycastle.pqc.math.linearalgebra.Matrix;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public final class zzhk implements Serializable {
|
|
private static final TimeZone GMT = TimeZone.getTimeZone("GMT");
|
|
private static final Pattern zzzm = Pattern.compile("^(\\d{4})-(\\d{2})-(\\d{2})([Tt](\\d{2}):(\\d{2}):(\\d{2})(\\.\\d+)?)?([Zz]|([+-])(\\d{2}):(\\d{2}))?");
|
|
private final long value;
|
|
private final boolean zzzn;
|
|
private final int zzzo;
|
|
|
|
public zzhk(long j) {
|
|
this(false, 0L, null);
|
|
}
|
|
|
|
private zzhk(boolean z, long j, Integer num) {
|
|
int offset;
|
|
this.zzzn = z;
|
|
this.value = j;
|
|
if (z) {
|
|
offset = 0;
|
|
} else {
|
|
offset = num == null ? TimeZone.getDefault().getOffset(j) / 60000 : num.intValue();
|
|
}
|
|
this.zzzo = offset;
|
|
}
|
|
|
|
public final String zzhe() {
|
|
StringBuilder sb = new StringBuilder();
|
|
GregorianCalendar gregorianCalendar = new GregorianCalendar(GMT);
|
|
gregorianCalendar.setTimeInMillis(this.value + (this.zzzo * 60000));
|
|
zza(sb, gregorianCalendar.get(1), 4);
|
|
sb.append('-');
|
|
zza(sb, gregorianCalendar.get(2) + 1, 2);
|
|
sb.append('-');
|
|
zza(sb, gregorianCalendar.get(5), 2);
|
|
if (!this.zzzn) {
|
|
sb.append('T');
|
|
zza(sb, gregorianCalendar.get(11), 2);
|
|
sb.append(':');
|
|
zza(sb, gregorianCalendar.get(12), 2);
|
|
sb.append(':');
|
|
zza(sb, gregorianCalendar.get(13), 2);
|
|
if (gregorianCalendar.isSet(14)) {
|
|
sb.append('.');
|
|
zza(sb, gregorianCalendar.get(14), 3);
|
|
}
|
|
int i = this.zzzo;
|
|
if (i == 0) {
|
|
sb.append(Matrix.MATRIX_TYPE_ZERO);
|
|
} else {
|
|
if (i > 0) {
|
|
sb.append('+');
|
|
} else {
|
|
sb.append('-');
|
|
i = -i;
|
|
}
|
|
zza(sb, i / 60, 2);
|
|
sb.append(':');
|
|
zza(sb, i % 60, 2);
|
|
}
|
|
}
|
|
return sb.toString();
|
|
}
|
|
|
|
public final String toString() {
|
|
return zzhe();
|
|
}
|
|
|
|
public final boolean equals(Object obj) {
|
|
if (obj == this) {
|
|
return true;
|
|
}
|
|
if (!(obj instanceof zzhk)) {
|
|
return false;
|
|
}
|
|
zzhk zzhkVar = (zzhk) obj;
|
|
return this.zzzn == zzhkVar.zzzn && this.value == zzhkVar.value && this.zzzo == zzhkVar.zzzo;
|
|
}
|
|
|
|
public final int hashCode() {
|
|
long[] jArr = new long[3];
|
|
jArr[0] = this.value;
|
|
jArr[1] = this.zzzn ? 1L : 0L;
|
|
jArr[2] = this.zzzo;
|
|
return Arrays.hashCode(jArr);
|
|
}
|
|
|
|
public static zzhk zzap(String str) throws NumberFormatException {
|
|
int i;
|
|
boolean z;
|
|
int i2;
|
|
int i3;
|
|
int i4;
|
|
int i5;
|
|
Integer num;
|
|
int i6;
|
|
Matcher matcher = zzzm.matcher(str);
|
|
if (!matcher.matches()) {
|
|
String valueOf = String.valueOf(str);
|
|
throw new NumberFormatException(valueOf.length() != 0 ? "Invalid date/time format: ".concat(valueOf) : new String("Invalid date/time format: "));
|
|
}
|
|
int parseInt = Integer.parseInt(matcher.group(1));
|
|
int parseInt2 = Integer.parseInt(matcher.group(2));
|
|
int parseInt3 = Integer.parseInt(matcher.group(3));
|
|
boolean z2 = matcher.group(4) != null;
|
|
String group = matcher.group(9);
|
|
boolean z3 = group != null;
|
|
if (z3 && !z2) {
|
|
String valueOf2 = String.valueOf(str);
|
|
throw new NumberFormatException(valueOf2.length() != 0 ? "Invalid date/time format, cannot specify time zone shift without specifying time: ".concat(valueOf2) : new String("Invalid date/time format, cannot specify time zone shift without specifying time: "));
|
|
}
|
|
if (z2) {
|
|
int parseInt4 = Integer.parseInt(matcher.group(5));
|
|
int parseInt5 = Integer.parseInt(matcher.group(6));
|
|
int parseInt6 = Integer.parseInt(matcher.group(7));
|
|
if (matcher.group(8) != null) {
|
|
z = z2;
|
|
i = parseInt2;
|
|
i2 = (int) (Integer.parseInt(matcher.group(8).substring(1)) / Math.pow(10.0d, matcher.group(8).substring(1).length() - 3));
|
|
} else {
|
|
i = parseInt2;
|
|
z = z2;
|
|
i2 = 0;
|
|
}
|
|
i4 = parseInt5;
|
|
i5 = parseInt6;
|
|
i3 = parseInt4;
|
|
} else {
|
|
i = parseInt2;
|
|
z = z2;
|
|
i2 = 0;
|
|
i3 = 0;
|
|
i4 = 0;
|
|
i5 = 0;
|
|
}
|
|
GregorianCalendar gregorianCalendar = new GregorianCalendar(GMT);
|
|
gregorianCalendar.set(parseInt, i - 1, parseInt3, i3, i4, i5);
|
|
gregorianCalendar.set(14, i2);
|
|
long timeInMillis = gregorianCalendar.getTimeInMillis();
|
|
if (z && z3) {
|
|
if (Character.toUpperCase(group.charAt(0)) == 'Z') {
|
|
i6 = 0;
|
|
} else {
|
|
int parseInt7 = (Integer.parseInt(matcher.group(11)) * 60) + Integer.parseInt(matcher.group(12));
|
|
i6 = matcher.group(10).charAt(0) == '-' ? -parseInt7 : parseInt7;
|
|
timeInMillis -= i6 * 60000;
|
|
}
|
|
num = Integer.valueOf(i6);
|
|
} else {
|
|
num = null;
|
|
}
|
|
return new zzhk(true ^ z, timeInMillis, num);
|
|
}
|
|
|
|
private static void zza(StringBuilder sb, int i, int i2) {
|
|
if (i < 0) {
|
|
sb.append('-');
|
|
i = -i;
|
|
}
|
|
int i3 = i;
|
|
while (i3 > 0) {
|
|
i3 /= 10;
|
|
i2--;
|
|
}
|
|
for (int i4 = 0; i4 < i2; i4++) {
|
|
sb.append('0');
|
|
}
|
|
if (i != 0) {
|
|
sb.append(i);
|
|
}
|
|
}
|
|
}
|