diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-03-03 12:38:30 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-03-03 12:38:30 +0000 |
| commit | a2e3a20a441e604550f0036ca198d5d2122e16a7 (patch) | |
| tree | c0da2b4ace57020b9973f20108e8bbf11ed4e444 /src/lib/util.cc | |
| parent | c93389b617d2b1a4f5b36025e3097a9f03a7c9cf (diff) | |
Fix rounding of timecodes in at least some cases (#323).
Reported-by: Gérald Maruccia
Diffstat (limited to 'src/lib/util.cc')
| -rw-r--r-- | src/lib/util.cc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/lib/util.cc b/src/lib/util.cc index 25fbc130b..f604cd10a 100644 --- a/src/lib/util.cc +++ b/src/lib/util.cc @@ -1016,3 +1016,13 @@ entities_to_text (string e) boost::algorithm::replace_all (e, "%2F", "/"); return e; } + +int64_t +divide_with_round (int64_t a, int64_t b) +{ + if (a % b >= (b / 2)) { + return (a + b - 1) / b; + } else { + return a / b; + } +} |
