From 17c30b568787f89138e7d201ba5b7a02f319d27a Mon Sep 17 00:00:00 2001 From: Julien Lancelot Date: Mon, 24 Feb 2014 17:49:12 +0100 Subject: [PATCH] Fix quality flaws --- .../java/org/sonar/api/utils/WorkDuration.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) 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); } -- 2.39.5