aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api/src/main/java/org/sonar
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2014-02-24 17:49:12 +0100
committerJulien Lancelot <julien.lancelot@sonarsource.com>2014-02-24 17:49:12 +0100
commit17c30b568787f89138e7d201ba5b7a02f319d27a (patch)
treeef0edb8e897eae780e68f4a01538d73fc015b629 /sonar-plugin-api/src/main/java/org/sonar
parentfb1195fcaab56349b2886832bb41547165fc1184 (diff)
downloadsonarqube-17c30b568787f89138e7d201ba5b7a02f319d27a.tar.gz
sonarqube-17c30b568787f89138e7d201ba5b7a02f319d27a.zip
Fix quality flaws
Diffstat (limited to 'sonar-plugin-api/src/main/java/org/sonar')
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/utils/WorkDuration.java14
1 files 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);
}