package ῲ.ᨨ.㿎;

import com.facebook.AccessTokenManager;
import java.io.PrintWriter;

/* renamed from: ῲ.ᨨ.㿎.ⁱ  reason: contains not printable characters */
/* compiled from: TimeUtils */
public final class C1868 {

    /* renamed from: ῲ  reason: contains not printable characters */
    public static char[] f6316 = new char[24];

    /* renamed from: K  reason: contains not printable characters */
    public static final Object f6317 = new Object();

    /* renamed from: K  reason: contains not printable characters */
    public static int m4829(int i, int i2, boolean z, int i3) {
        if (i > 99 || (z && i3 >= 3)) {
            return i2 + 3;
        }
        if (i > 9 || (z && i3 >= 2)) {
            return i2 + 2;
        }
        if (z || i > 0) {
            return i2 + 1;
        }
        return 0;
    }

    /* renamed from: K  reason: contains not printable characters */
    public static int m4831(char[] cArr, int i, char c, int i2, boolean z, int i3) {
        int i4;
        if (!z && i <= 0) {
            return i2;
        }
        if ((!z || i3 < 3) && i <= 99) {
            i4 = i2;
        } else {
            int i5 = i / 100;
            cArr[i2] = (char) (i5 + 48);
            i4 = i2 + 1;
            i -= i5 * 100;
        }
        if ((z && i3 >= 2) || i > 9 || i2 != i4) {
            int i6 = i / 10;
            cArr[i4] = (char) (i6 + 48);
            i4++;
            i -= i6 * 10;
        }
        cArr[i4] = (char) (i + 48);
        int i7 = i4 + 1;
        cArr[i7] = c;
        return i7 + 1;
    }

    /* renamed from: K  reason: contains not printable characters */
    public static int m4830(long j, int i) {
        char c;
        int i2;
        int i3;
        int i4;
        int i5;
        int i6;
        long j2 = j;
        if (f6316.length < i) {
            f6316 = new char[i];
        }
        char[] cArr = f6316;
        int i7 = (j2 > 0 ? 1 : (j2 == 0 ? 0 : -1));
        if (i7 == 0) {
            int i8 = i - 1;
            while (i8 > 0) {
                cArr[0] = ' ';
            }
            cArr[0] = '0';
            return 1;
        }
        if (i7 > 0) {
            c = '+';
        } else {
            c = '-';
            j2 = -j2;
        }
        int i9 = (int) (j2 % 1000);
        int floor = (int) Math.floor((double) (j2 / 1000));
        if (floor > 86400) {
            i2 = floor / 86400;
            floor -= 86400 * i2;
        } else {
            i2 = 0;
        }
        if (floor > 3600) {
            i3 = floor / AccessTokenManager.TOKEN_EXTEND_RETRY_SECONDS;
            floor -= i3 * AccessTokenManager.TOKEN_EXTEND_RETRY_SECONDS;
        } else {
            i3 = 0;
        }
        if (floor > 60) {
            int i10 = floor / 60;
            i4 = floor - (i10 * 60);
            i5 = i10;
        } else {
            i4 = floor;
            i5 = 0;
        }
        if (i != 0) {
            int r7 = m4829(i2, 1, false, 0);
            int r8 = m4829(i3, 1, r7 > 0, 2) + r7;
            int r72 = m4829(i5, 1, r8 > 0, 2) + r8;
            int r82 = m4829(i4, 1, r72 > 0, 2) + r72;
            i6 = 0;
            for (int r73 = m4829(i9, 2, true, r82 > 0 ? 3 : 0) + 1 + r82; r73 < i; r73++) {
                cArr[i6] = ' ';
                i6++;
            }
        } else {
            i6 = 0;
        }
        cArr[i6] = c;
        int i11 = i6 + 1;
        boolean z = i != 0;
        int r74 = m4831(cArr, i2, 'd', i11, false, 0);
        int r75 = m4831(cArr, i3, 'h', r74, r74 != i11, z ? 2 : 0);
        int r76 = m4831(cArr, i5, 'm', r75, r75 != i11, z ? 2 : 0);
        int r77 = m4831(cArr, i4, 's', r76, r76 != i11, z ? 2 : 0);
        int r0 = m4831(cArr, i9, 'm', r77, true, (!z || r77 == i11) ? 0 : 3);
        cArr[r0] = 's';
        return r0 + 1;
    }

    /* renamed from: K  reason: contains not printable characters */
    public static void m4832(long j, PrintWriter printWriter, int i) {
        synchronized (f6317) {
            printWriter.print(new String(f6316, 0, m4830(j, i)));
        }
    }
}
