From e63fe3b8d058bed15d65728f8e9a7e4093040028 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 2 Aug 2014 03:38:31 +0200 Subject: Don't use exponential notation for integers --- src/fastd.h | 2 +- src/peer.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/fastd.h b/src/fastd.h index 5619e66..c52a690 100644 --- a/src/fastd.h +++ b/src/fastd.h @@ -439,7 +439,7 @@ static inline bool timespec_after(const struct timespec *tp1, const struct times /** Returns (\a tp1 - \a tp2) in milliseconds */ static inline int timespec_diff(const struct timespec *tp1, const struct timespec *tp2) { - return ((tp1->tv_sec - tp2->tv_sec))*1000 + (tp1->tv_nsec - tp2->tv_nsec)/1e6; + return ((tp1->tv_sec - tp2->tv_sec))*1000 + (tp1->tv_nsec - tp2->tv_nsec)/1000000; } /** diff --git a/src/peer.c b/src/peer.c index 8ff40dc..53b9f64 100644 --- a/src/peer.c +++ b/src/peer.c @@ -261,11 +261,11 @@ void fastd_peer_schedule_handshake(fastd_peer_t *peer, int delay) { peer->next_handshake = ctx.now; peer->next_handshake.tv_sec += delay/1000; - peer->next_handshake.tv_nsec += (delay%1000)*1e6; + peer->next_handshake.tv_nsec += (delay%1000)*1000000; - if (peer->next_handshake.tv_nsec > 1e9) { + if (peer->next_handshake.tv_nsec > 1000000000) { peer->next_handshake.tv_sec++; - peer->next_handshake.tv_nsec -= 1e9; + peer->next_handshake.tv_nsec -= 1000000000; } fastd_dlist_head_t *list; -- cgit v1.2.3