B20.1 gettimeofday returns incorrect tv_secs

Alexander Dupuy dupuy@hydraweb.com
Wed Oct 20 15:34:00 GMT 1999


The tv_secs returned by gettimeofday for a simple CYGWIN application don't
match the (correct) seconds since 1970 returned by time().  This breaks
applications (like mine) that sometimes use time() and sometimes
gettimeofday().

@alex
-- 
mailto:dupuy@hydraweb.com
#include <stdio.h>
#include <sys/time.h>

int main()
{
	struct timeval tv;
	struct timezone tz;
	gettimeofday (&tv, &tz);
	printf ("%d =?= %d\n", tv.tv_sec, time(NULL));
	return 0;
}


More information about the Cygwin mailing list