aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPJ Fanning <fanningpj@apache.org>2023-07-24 10:12:46 +0000
committerPJ Fanning <fanningpj@apache.org>2023-07-24 10:12:46 +0000
commitcd2dcd3940becb8f48dc75934e94c96c592e3222 (patch)
tree525d93b925e629ff4f44fe2265b465267de7d160
parentfa8650fbe311b2cd2d2a44d80cb8ec6768245e60 (diff)
downloadpoi-cd2dcd3940becb8f48dc75934e94c96c592e3222.tar.gz
poi-cd2dcd3940becb8f48dc75934e94c96c592e3222.zip
[github-487] Round up seconds in CellElapsedFormatter. Thanks to Anthony Schott. This closes #487
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1911228 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--poi/src/main/java/org/apache/poi/ss/format/CellElapsedFormatter.java2
-rw-r--r--test-data/spreadsheet/ElapsedFormatTests.xlsxbin36062 -> 15183 bytes
2 files changed, 1 insertions, 1 deletions
diff --git a/poi/src/main/java/org/apache/poi/ss/format/CellElapsedFormatter.java b/poi/src/main/java/org/apache/poi/ss/format/CellElapsedFormatter.java
index 43069d2eab..93fc537d12 100644
--- a/poi/src/main/java/org/apache/poi/ss/format/CellElapsedFormatter.java
+++ b/poi/src/main/java/org/apache/poi/ss/format/CellElapsedFormatter.java
@@ -59,7 +59,7 @@ public class CellElapsedFormatter extends CellFormatter {
val = elapsed / factor;
else
val = elapsed / factor % modBy;
- if (type == '0')
+ if (type == '0' || type == 's')
return Math.round(val);
else
return (long) val;
diff --git a/test-data/spreadsheet/ElapsedFormatTests.xlsx b/test-data/spreadsheet/ElapsedFormatTests.xlsx
index 95a093e8d4..eacc071a41 100644
--- a/test-data/spreadsheet/ElapsedFormatTests.xlsx
+++ b/test-data/spreadsheet/ElapsedFormatTests.xlsx
Binary files differ