Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com From: "Philip Aston" MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15561.26590.782158.717023@lineone.net> Date: Fri, 26 Apr 2002 15:44:46 +0100 To: cygwin AT cygwin DOT com Subject: gettime time travels after suspend I have a running process which prints out the result of gettimeofday() at regular intervals. If I suspend and resume my machine then the value returned by gettimeofday() is incorrect - it jumps several days into the future. Doing the same with time() is fine. I don't want to point fingers, but I suspect the following 1.3.10 change: - Use QueryPerformance* functions for gettimeofday calls. (cgf) Test case below. Regards, - Phil #include #include int main() { struct timeval t; time_t t2; while (1) { gettimeofday(&t, 0); time(&t2); printf("gettimeofday() returns %ld %ld\n", t.tv_sec, t.tv_usec); printf("time() returns %ld\n", t2); sleep(2); } } PASTON:philipa% uname -a CYGWIN_NT-5.0 PASTON 1.3.10(0.51/3/2) 2002-02-25 11:14 i686 unknown PASTON:philipa% ./gettimeofday-bug gettimeofday() returns 1018681622 612224 time() returns 1018681623 gettimeofday() returns 1018681624 615154 time() returns 1018681625 gettimeofday() returns 1018681626 618384 time() returns 1018681627 <<< Suspend and resume machine >>> gettimeofday() returns 1018932412 90805 time() returns 1018681632 gettimeofday() returns 1018932422 917318 time() returns 1018681642 gettimeofday() returns 1018932424 911611 time() returns 1018681644 -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/