Discussion of chess software programming and technical issues.
	Moderator:  Ras 
	
	
			
	
			
		
			
		
		
			
				
								Look  
									
		Posts:  382Joined:  Thu Jun 05, 2014 2:14 pmLocation:  IranFull name:  Mehdi Amini 
		
						
					
								
						
									Post by Look  Sat Feb 29, 2020 2:31 pm 
			
			
			
			
			
			Hi,
I changed CFLAGS to following in XBoard Makefile (any better way?). Now there seems to be some problems with timeZone.
Code: Select all 
CFLAGS = -std=c11 -Wall -Wextra -pedantic 
Note that I used -Weverything but I removed this since it produced massive number of warnings.
Now:
Code: Select all 
#if HAVE_GETTIMEOFDAY
#include <sys/time.h>
//#include <sys/timeb.h>
    struct timeval timeVal;
    struct timezone timeZone;
    gettimeofday(&timeVal, &timeZone);
    tm->sec = (long) timeVal.tv_sec;
    tm->ms = (int) (timeVal.tv_usec / 1000L);
#else /*!HAVE_GETTIMEOFDAY*/
I get:
Code: Select all 
backend.c: In function ‘GetTimeMark’:
backend.c:17839:21: error: storage size of ‘timeZone’ isn’t known
     struct timezone timeZone;
                     ^~~~~~~~
What can I do ?
Edit: Corrected title.
Farewell.
			
						 
		 
				
		
		 
	 
				
		
		
			
				
								hgm  
									
		Posts:  28398Joined:  Fri Mar 10, 2006 10:06 amLocation:  AmsterdamFull name:  H G Muller 
		
						
					
								
						
									Post by hgm  Sat Feb 29, 2020 2:51 pm 
			
			
			
			
			
			Says 
here  the timezone argument of gettimeofday is obsolete. Apparently it is no longer defined in the system headers used with the C11 standard. Just set the second argument of gettimeofday to NULL, and delete the declaration. It was just passed as a dummy anyway, and not used for anything.
 
		 
				
		
		 
	 
				
		
		
			
				
								Look  
									
		Posts:  382Joined:  Thu Jun 05, 2014 2:14 pmLocation:  IranFull name:  Mehdi Amini 
		
						
					
								
						
									Post by Look  Sun Mar 01, 2020 2:22 pm 
			
			
			
			
			
			I added code like this , is it OK ?
Code: Select all 
[...]
#if defined __STDC__
struct timezone {
    int tz_minuteswest;
    int tz_dsttime;
};
#endif /* __STDC__ */
[...]
Farewell.