Skip to content

Commit

Permalink
Replace deprecated getPastTimeString with getTimeSpanString (#1007)
Browse files Browse the repository at this point in the history
Replaced with OpenRewrite command:

mvn -U org.openrewrite.maven:rewrite-maven-plugin:run \
      -Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-jenkins:RELEASE \
      -Drewrite.activeRecipes=org.openrewrite.jenkins.migrate.hudson.UtilGetPastTimeStringToGetTimeSpanString

jenkinsci/jenkins#4174 deprecates the API in a
2019 release of Jenkins core.

https://javadoc.jenkins.io/hudson/Util.html#getPastTimeString(long)
declares it deprecated.
  • Loading branch information
MarkEWaite authored Aug 27, 2023
1 parent a8647ad commit 38830da
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public String getWhenDisabledBySystemString() {
final long now = readTimeNowInNanoseconds();
final long howLongAgoInNanoseconds = now - nanotimeWhenDisabledBySystem;
final long howLongAgoInMilliseconds = TimeUnit.NANOSECONDS.toMillis(howLongAgoInNanoseconds);
return Util.getPastTimeString(howLongAgoInMilliseconds);
return Util.getTimeSpanString(howLongAgoInMilliseconds);
}

/**
Expand Down

0 comments on commit 38830da

Please sign in to comment.