Function name : tzset
Header file : <time.h>
Function prototype : void tzset(void);
Function : Time compatibility with UNIX operating system
Parameters : no parameters
Return value : No return value
Program example: Implementing UNIX time compatibility
#include<stdio.h>#include<time.h>intmain(void){time_ttd;if(putenv(TZ=PST8PDT)==-1){//Set environment variables and determine whether it is successful printf(Unabletosetzn );return0;}tzset();//Set UNIX time compatible time(&td);printf(Currenttime=%sn,asctime(localtime(&td)));return0;}
Running results
Currenttime=TueJun1606:32:062020