diff --git a/src/main/java/com/adobe/epubcheck/opf/OPFChecker30.java b/src/main/java/com/adobe/epubcheck/opf/OPFChecker30.java
index f249a1193..a8b7fd963 100644
--- a/src/main/java/com/adobe/epubcheck/opf/OPFChecker30.java
+++ b/src/main/java/com/adobe/epubcheck/opf/OPFChecker30.java
@@ -439,7 +439,7 @@ private void checkMediaOverlaysDuration()
}
}
// report if the sum and total don't match
- if (!totalDuration.equals(sumDuration))
+ if (!totalDuration.eqWithinTolerance(sumDuration, 1000))
{
report.message(MessageId.MED_016, EPUBLocation.of(context));
}
diff --git a/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-duration-total-not-sum-warning.opf b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-duration-total-not-sum-warning.opf
index 42b376cb2..85f9f0d6d 100644
--- a/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-duration-total-not-sum-warning.opf
+++ b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-duration-total-not-sum-warning.opf
@@ -9,7 +9,7 @@
10min
5min
- 0:05:00.200
+ 0:05:01.100
diff --git a/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-duration-total-within-tolerance-valid.opf b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-duration-total-within-tolerance-valid.opf
new file mode 100644
index 000000000..bc7106cc4
--- /dev/null
+++ b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-duration-total-within-tolerance-valid.opf
@@ -0,0 +1,22 @@
+
+
+
+ Title
+ en
+ NOID
+ 2019-01-01T12:00:00Z
+
+ 10min
+ 5min
+ 0:05:00.500
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/epub3/09-media-overlays/media-overlays.feature b/src/test/resources/epub3/09-media-overlays/media-overlays.feature
index 0e9eb7a48..472730378 100644
--- a/src/test/resources/epub3/09-media-overlays/media-overlays.feature
+++ b/src/test/resources/epub3/09-media-overlays/media-overlays.feature
@@ -316,7 +316,13 @@ Feature: EPUB 3 — Media Overlays
And the message contains "item media:duration meta element not set"
And no other errors or warnings are reported
+ @spec @xref:sec-mo-package-metadata
Scenario: the total duration should be the sum of all Media Overlay durations
When checking file 'mediaoverlays-duration-total-not-sum-warning.opf'
Then warning MED-016 is reported
And no other errors or warnings are reported
+
+ @spec @xref:sec-mo-package-metadata
+ Scenario: the total duration has a 1s tolerance
+ When checking file 'mediaoverlays-duration-total-within-tolerance-valid.opf'
+ Then no errors or warnings are reported