package p5;

import java.io.InterruptedIOException;
import java.util.concurrent.TimeUnit;

/* JADX INFO: loaded from: classes3.dex */
public class S {

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public static final Q f23074d = new Q();

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public boolean f23075a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public long f23076b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public long f23077c;

    public S a() {
        this.f23075a = false;
        return this;
    }

    public S b() {
        this.f23077c = 0L;
        return this;
    }

    public long c() {
        if (this.f23075a) {
            return this.f23076b;
        }
        throw new IllegalStateException("No deadline");
    }

    public S d(long j4) {
        this.f23075a = true;
        this.f23076b = j4;
        return this;
    }

    public boolean e() {
        return this.f23075a;
    }

    public void f() throws InterruptedIOException {
        if (Thread.currentThread().isInterrupted()) {
            throw new InterruptedIOException("interrupted");
        }
        if (this.f23075a && this.f23076b - System.nanoTime() <= 0) {
            throw new InterruptedIOException("deadline reached");
        }
    }

    public S g(long j4, TimeUnit unit) {
        kotlin.jvm.internal.o.h(unit, "unit");
        if (j4 < 0) {
            throw new IllegalArgumentException(A0.a.m("timeout < 0: ", j4).toString());
        }
        this.f23077c = unit.toNanos(j4);
        return this;
    }
}
