delorie.com/archives/browse.cgi | search |
X-Spam-Check-By: | sourceware.org |
To: | cygwin AT cygwin DOT com |
From: | "Cary Jamison" <Cary_Jamison AT Symantec DOT com> |
Subject: | Re: strange bug in gettimeofday function |
Date: | Thu, 15 Feb 2007 17:50:48 -0700 |
Lines: | 17 |
Message-ID: | <er2v5b$nmj$1@sea.gmane.org> |
References: | <13811889795 DOT 20070215071733 AT gnu DOT org> |
X-IsSubscribed: | yes |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Id: | <cygwin.cygwin.com> |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sourceware.org/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
Sender: | cygwin-owner AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
Delivered-To: | mailing list cygwin AT cygwin DOT com |
Andrew Makhorin wrote: > double get_time(void) > { struct timeval tv; > gettimeofday(&tv, NULL); > return (double)tv.tv_sec + 1e-6 * (double)tv.tv_usec; > } I would be suspicious of floating-point rounding errors here for the original problem you described. Why don't you try a test case that just checks if one tv is ever less than a previous tv, without the conversions. Cary -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |