this code works on Linux, but not msys2:

#include<stdio.h>
#include<sys time.h="">
int main() {
&nbsp;&nbsp;&nbsp; struct timezone tz;
&nbsp;&nbsp;&nbsp; puts("a");
&nbsp;&nbsp;&nbsp; gettimeofday(NULL, &amp;tz);
&nbsp;&nbsp;&nbsp; puts("b");
}


I guess the reason would be
winsup/cygwin/times.cc

extern "C" int
gettimeofday (struct timeval *__restrict tv, void *__restrict tzvp)
{
  struct timezone *tz = (struct timezone *) tzvp;
  static bool tzflag;
  LONGLONG now = get_clock (CLOCK_REALTIME)-&gt;usecs ();

  tv-&gt;tv_sec = now / USPERSEC;
  tv-&gt;tv_usec = now % USPERSEC;


If so, the fix should be add if (tv != NULL)

I found this issue due to 
https://github.com/redis/redis/issues/12719</sys></stdio.h>

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

Reply via email to