From: Julien Lancelot Date: Mon, 24 Feb 2014 16:49:12 +0000 (+0100) Subject: Fix quality flaws X-Git-Tag: 4.2~53 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=17c30b568787f89138e7d201ba5b7a02f319d27a;p=sonarqube.git Fix quality flaws --- diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/WorkDuration.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/WorkDuration.java index 269d7cb0a87..84e9ff5d85a 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/WorkDuration.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/WorkDuration.java @@ -37,9 +37,7 @@ public class WorkDuration implements Serializable { static final int HOUR_POSITION_IN_LONG = 100; static final int MINUTE_POSITION_IN_LONG = 1; - public static enum UNIT { - DAYS, HOURS, MINUTES - } + public static enum UNIT {DAYS, HOURS, MINUTES} private int hoursInDay; @@ -100,11 +98,11 @@ public class WorkDuration implements Serializable { } static WorkDuration createFromSeconds(long seconds, int hoursInDay) { - int days = (int) (seconds / hoursInDay / 60d / 60d); - long currentDurationInSeconds = seconds - (days * hoursInDay * 3600); - int hours = (int) (currentDurationInSeconds / 60d / 60d); - currentDurationInSeconds = currentDurationInSeconds - (hours * 3600); - int minutes = (int) (currentDurationInSeconds / 60d); + int days = (int) (seconds / hoursInDay / 60f / 60f); + long currentDurationInSeconds = seconds - (3600L * days * hoursInDay); + int hours = (int) (currentDurationInSeconds / 60f / 60f); + currentDurationInSeconds = currentDurationInSeconds - (3600L * hours); + int minutes = (int) (currentDurationInSeconds / 60f); return new WorkDuration(seconds, days, hours, minutes, hoursInDay); }