You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2021/11/27 11:11:33 UTC

[groovy] branch master updated: Trivial tweak: avoid type cast

This is an automated email from the ASF dual-hosted git repository.

sunlan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git


The following commit(s) were added to refs/heads/master by this push:
     new 6b1f430  Trivial tweak: avoid type cast
6b1f430 is described below

commit 6b1f43087c4dcfc0034724afb3f3c88f60c25aa7
Author: Daniel Sun <su...@apache.org>
AuthorDate: Sat Nov 27 19:10:36 2021 +0800

    Trivial tweak: avoid type cast
---
 src/main/java/groovy/time/Duration.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/main/java/groovy/time/Duration.java b/src/main/java/groovy/time/Duration.java
index 94d64b7..deaeeac 100644
--- a/src/main/java/groovy/time/Duration.java
+++ b/src/main/java/groovy/time/Duration.java
@@ -79,12 +79,12 @@ public class Duration extends BaseDuration {
 
     @Override
     public long toMilliseconds() {
-        return ((((((long)(this.getDays() * 24 ) + this.getHours()) * 60 + this.getMinutes()) * 60) + this.getSeconds()) * 1000) + this.getMillis();
+        return ((((((this.getDays() * 24L) + this.getHours()) * 60 + this.getMinutes()) * 60) + this.getSeconds()) * 1000) + this.getMillis();
     }
 
     @Override
     public Date getAgo() {
-    final Calendar cal = Calendar.getInstance();
+        final Calendar cal = Calendar.getInstance();
 
         cal.add(Calendar.DAY_OF_YEAR, -this.getDays());
         cal.add(Calendar.HOUR_OF_DAY, -this.getHours());