102 lines
3.7 KiB
Java
102 lines
3.7 KiB
Java
|
package o;
|
||
|
|
||
|
import java.sql.Time;
|
||
|
import java.sql.Timestamp;
|
||
|
import java.util.Calendar;
|
||
|
import java.util.Date;
|
||
|
import java.util.GregorianCalendar;
|
||
|
import java.util.TimeZone;
|
||
|
|
||
|
/* renamed from: o.gsm, reason: case insensitive filesystem */
|
||
|
/* loaded from: classes6.dex */
|
||
|
public final class C15517gsm {
|
||
|
private C15517gsm() {
|
||
|
}
|
||
|
|
||
|
public static C15523gss toInstant(Date date) {
|
||
|
return C15523gss.ofEpochMilli(date.getTime());
|
||
|
}
|
||
|
|
||
|
public static Date toDate(C15523gss c15523gss) {
|
||
|
try {
|
||
|
return new Date(c15523gss.toEpochMilli());
|
||
|
} catch (ArithmeticException e) {
|
||
|
throw new IllegalArgumentException(e);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public static C15523gss toInstant(Calendar calendar) {
|
||
|
return C15523gss.ofEpochMilli(calendar.getTimeInMillis());
|
||
|
}
|
||
|
|
||
|
public static gsN toZonedDateTime(Calendar calendar) {
|
||
|
return gsN.ofInstant(C15523gss.ofEpochMilli(calendar.getTimeInMillis()), toZoneId(calendar.getTimeZone()));
|
||
|
}
|
||
|
|
||
|
public static GregorianCalendar toGregorianCalendar(gsN gsn) {
|
||
|
GregorianCalendar gregorianCalendar = new GregorianCalendar(toTimeZone(gsn.getZone()));
|
||
|
gregorianCalendar.setGregorianChange(new Date(Long.MIN_VALUE));
|
||
|
gregorianCalendar.setFirstDayOfWeek(2);
|
||
|
gregorianCalendar.setMinimalDaysInFirstWeek(4);
|
||
|
try {
|
||
|
gregorianCalendar.setTimeInMillis(gsn.toInstant().toEpochMilli());
|
||
|
return gregorianCalendar;
|
||
|
} catch (ArithmeticException e) {
|
||
|
throw new IllegalArgumentException(e);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public static AbstractC15502gsH toZoneId(TimeZone timeZone) {
|
||
|
return AbstractC15502gsH.of(timeZone.getID(), AbstractC15502gsH.SHORT_IDS);
|
||
|
}
|
||
|
|
||
|
public static TimeZone toTimeZone(AbstractC15502gsH abstractC15502gsH) {
|
||
|
String id = abstractC15502gsH.getId();
|
||
|
if (id.startsWith("+") || id.startsWith("-")) {
|
||
|
id = "GMT".concat(String.valueOf(id));
|
||
|
} else if (id.equals("Z")) {
|
||
|
id = "UTC";
|
||
|
}
|
||
|
return TimeZone.getTimeZone(id);
|
||
|
}
|
||
|
|
||
|
public static C15520gsp toLocalDate(java.sql.Date date) {
|
||
|
return C15520gsp.of(date.getYear() + 1900, date.getMonth() + 1, date.getDate());
|
||
|
}
|
||
|
|
||
|
public static java.sql.Date toSqlDate(C15520gsp c15520gsp) {
|
||
|
return new java.sql.Date(c15520gsp.getYear() - 1900, c15520gsp.getMonthValue() - 1, c15520gsp.getDayOfMonth());
|
||
|
}
|
||
|
|
||
|
public static C15521gsq toLocalTime(Time time) {
|
||
|
return C15521gsq.of(time.getHours(), time.getMinutes(), time.getSeconds());
|
||
|
}
|
||
|
|
||
|
public static Time toSqlTime(C15521gsq c15521gsq) {
|
||
|
return new Time(c15521gsq.getHour(), c15521gsq.getMinute(), c15521gsq.getSecond());
|
||
|
}
|
||
|
|
||
|
public static Timestamp toSqlTimestamp(C15522gsr c15522gsr) {
|
||
|
return new Timestamp(c15522gsr.getYear() - 1900, c15522gsr.getMonthValue() - 1, c15522gsr.getDayOfMonth(), c15522gsr.getHour(), c15522gsr.getMinute(), c15522gsr.getSecond(), c15522gsr.getNano());
|
||
|
}
|
||
|
|
||
|
public static C15522gsr toLocalDateTime(Timestamp timestamp) {
|
||
|
int year = timestamp.getYear();
|
||
|
return C15522gsr.of(year + 1900, timestamp.getMonth() + 1, timestamp.getDate(), timestamp.getHours(), timestamp.getMinutes(), timestamp.getSeconds(), timestamp.getNanos());
|
||
|
}
|
||
|
|
||
|
public static Timestamp toSqlTimestamp(C15523gss c15523gss) {
|
||
|
try {
|
||
|
Timestamp timestamp = new Timestamp(c15523gss.getEpochSecond() * 1000);
|
||
|
timestamp.setNanos(c15523gss.getNano());
|
||
|
return timestamp;
|
||
|
} catch (ArithmeticException e) {
|
||
|
throw new IllegalArgumentException(e);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public static C15523gss toInstant(Timestamp timestamp) {
|
||
|
return C15523gss.ofEpochSecond(timestamp.getTime() / 1000, timestamp.getNanos());
|
||
|
}
|
||
|
}
|