From 41d734846e17138c0edc34407389be007557f6cb Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 9 Oct 2011 21:21:50 +1100 Subject: [PATCH] fixed millis() and micros() --- libraries/Desktop/support/Arduino.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libraries/Desktop/support/Arduino.cpp b/libraries/Desktop/support/Arduino.cpp index 005083b525..7a6c7dc4bd 100644 --- a/libraries/Desktop/support/Arduino.cpp +++ b/libraries/Desktop/support/Arduino.cpp @@ -25,8 +25,8 @@ long unsigned int millis(void) extern struct timeval sketch_start_time; struct timeval tp; gettimeofday(&tp,NULL); - return 1.0e3*(tp.tv_sec + (tp.tv_usec*1.0e-6)) - - (sketch_start_time.tv_sec + (sketch_start_time.tv_usec*1.0e-6)); + return 1.0e3*((tp.tv_sec + (tp.tv_usec*1.0e-6)) - + (sketch_start_time.tv_sec + (sketch_start_time.tv_usec*1.0e-6))); } long unsigned int micros(void) @@ -34,8 +34,8 @@ long unsigned int micros(void) extern struct timeval sketch_start_time; struct timeval tp; gettimeofday(&tp,NULL); - return 1.0e6*(tp.tv_sec + (tp.tv_usec*1.0e-6)) - - (sketch_start_time.tv_sec + (sketch_start_time.tv_usec*1.0e-6)); + return 1.0e6*((tp.tv_sec + (tp.tv_usec*1.0e-6)) - + (sketch_start_time.tv_sec + (sketch_start_time.tv_usec*1.0e-6))); } void delay(long unsigned msec)