granularity level: instruction
.class public Lcom/google/android/datatransport/runtime/time/TestClock;
.super Ljava/lang/Object;
.source "TestClock.java"
.implements Lcom/google/android/datatransport/runtime/time/Clock;
.field private final timestamp:Ljava/util/concurrent/atomic/AtomicLong;
.method public constructor <init>(J)V
.locals 1
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
new-instance v0, Ljava/util/concurrent/atomic/AtomicLong;
invoke-direct {v0, p1, p2}, Ljava/util/concurrent/atomic/AtomicLong;-><init>(J)V
iput-object v0, p0, Lcom/google/android/datatransport/runtime/time/TestClock;->timestamp:Ljava/util/concurrent/atomic/AtomicLong;
return-void
.end method
.method public advance(J)V
.locals 3
const-wide/16 v0, 0x0
cmp-long v2, p1, v0
if-ltz v2, :cond_0
iget-object v0, p0, Lcom/google/android/datatransport/runtime/time/TestClock;->timestamp:Ljava/util/concurrent/atomic/AtomicLong;
invoke-virtual {v0, p1, p2}, Ljava/util/concurrent/atomic/AtomicLong;->addAndGet(J)J
return-void
:cond_0
new-instance p1, Ljava/lang/IllegalArgumentException;
const-string p2, "cannot advance time backwards."
invoke-direct {p1, p2}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw p1
.end method
.method public getTime()J
.locals 2
iget-object v0, p0, Lcom/google/android/datatransport/runtime/time/TestClock;->timestamp:Ljava/util/concurrent/atomic/AtomicLong;
invoke-virtual {v0}, Ljava/util/concurrent/atomic/AtomicLong;->get()J
move-result-wide v0
return-wide v0
.end method
.method public tick()V
.locals 2
const-wide/16 v0, 0x1
invoke-virtual {p0, v0, v1}, Lcom/google/android/datatransport/runtime/time/TestClock;->advance(J)V
return-void
.end method