package o; import java.io.PrintWriter; /* loaded from: classes.dex */ public final class rSm { private static final Object b = new Object(); private static char[] c = new char[24]; private static int d(char[] cArr, int i, char c2, int i2, boolean z, int i3) { int i4; if (!z && i <= 0) { return i2; } if (i > 99) { int i5 = i / 100; cArr[i2] = (char) (i5 + 48); i4 = i2 + 1; i -= i5 * 100; } else { i4 = i2; } if (i > 9 || i2 != i4) { int i6 = i / 10; cArr[i4] = (char) (i6 + 48); i4++; i -= i6 * 10; } cArr[i4] = (char) (i + 48); cArr[i4 + 1] = c2; return i4 + 2; } private static int c(long j) { char c2; int i; int i2; int i3; int i4; if (c.length < 0) { c = new char[0]; } char[] cArr = c; if (j == 0) { cArr[0] = '0'; return 1; } if (j > 0) { c2 = '+'; } else { j = -j; c2 = '-'; } int i5 = (int) (j % 1000); int floor = (int) Math.floor(j / 1000); if (floor > 86400) { i = floor / 86400; floor -= 86400 * i; } else { i = 0; } if (floor > 3600) { i2 = floor / 3600; floor -= i2 * 3600; } else { i2 = 0; } if (floor > 60) { int i6 = floor / 60; i3 = floor - (i6 * 60); i4 = i6; } else { i3 = floor; i4 = 0; } cArr[0] = c2; int d = d(cArr, i, 'd', 1, false, 0); int d2 = d(cArr, i2, 'h', d, d != 1, 0); int d3 = d(cArr, i4, 'm', d2, d2 != 1, 0); int d4 = d(cArr, i5, 'm', d(cArr, i3, 's', d3, d3 != 1, 0), true, 0); cArr[d4] = 's'; return d4 + 1; } private static void a(long j, PrintWriter printWriter) { synchronized (b) { printWriter.print(new String(c, 0, c(j))); } } public static void e(long j, PrintWriter printWriter) { a(j, printWriter); } public static void a(long j, long j2, PrintWriter printWriter) { if (j == 0) { printWriter.print("--"); } else { a(j - j2, printWriter); } } }