Skip to content

Commit

Permalink
Use Instant instead of untyped millis for TransferResource startTime
Browse files Browse the repository at this point in the history
  • Loading branch information
gnodet committed Dec 11, 2024
1 parent bba44d9 commit d9ac99c
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import java.io.File;
import java.nio.file.Path;
import java.time.Instant;

import org.eclipse.aether.RequestTrace;

Expand All @@ -38,7 +39,7 @@ public final class TransferResource {

private final Path path;

private final long startTime;
private final Instant startTime;

private final RequestTrace trace;

Expand Down Expand Up @@ -114,7 +115,7 @@ public TransferResource(
this.path = path;
this.resource = resource;
this.trace = trace;
this.startTime = System.currentTimeMillis();
this.startTime = Instant.now();
}

/**
Expand Down Expand Up @@ -234,6 +235,15 @@ public TransferResource setResumeOffset(long resumeOffset) {
* @return The timestamp when the transfer of this resource was started.
*/
public long getTransferStartTime() {
return startTime.toEpochMilli();
}

/**
* Gets the timestamp when the transfer of this resource was started.
*
* @return The timestamp when the transfer of this resource was started.
*/
public Instant getStartTime() {
return startTime;
}

Expand Down

0 comments on commit d9ac99c

Please sign in to comment.