summaryrefslogtreecommitdiffstats
path: root/uemis-downloader.c
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2014-02-12 14:19:53 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-02-12 17:41:49 -0800
commit23baf20f569f1f34ab4efa68996f24c3ad49fe05 (patch)
treedc10775b82b6f0e69d36bafeec54430bdec8126b /uemis-downloader.c
parent7ae05b4f710fc0d03a2198397e7dd779f477fd79 (diff)
downloadsubsurface-23baf20f569f1f34ab4efa68996f24c3ad49fe05.tar.gz
Use "rint()" instead of rounding manually with "+ 0.5"
rint() is "round to nearest integer", and does a better job than +0.5 (followed by the implicit truncation inherent in integer casting). We already used 'rint()' for values that could be negative (where +0.5 is actively wrong), let's just make it consistent. Of course, as is usual for the messy C math functions, it depends on the current rounding mode. But the default round-to-nearest is what we want and use, and the functions that explicitly always round to nearest aren't standard enough to worry about. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'uemis-downloader.c')
-rw-r--r--uemis-downloader.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/uemis-downloader.c b/uemis-downloader.c
index ceac29235..99a1a8bc8 100644
--- a/uemis-downloader.c
+++ b/uemis-downloader.c
@@ -65,7 +65,7 @@ static void uemis_ts(char *buffer, void *_when)
/* float minutes */
static void uemis_duration(char *buffer, duration_t *duration)
{
- duration->seconds = ascii_strtod(buffer, NULL) * 60 + 0.5;
+ duration->seconds = rint(ascii_strtod(buffer, NULL) * 60);
}
/* int cm */