| View previous topic :: View next topic | 
	
	
		| Author | Message | 
	
		| deepthij Beginner
 
 
 Joined: 08 May 2009
 Posts: 13
 Topics: 6
 Location: Bangalore
 
 | 
			
				|  Posted: Fri Jun 05, 2009 1:39 am    Post subject: Regarding __date__ __time__  and localtime in Z/OS |   |  
				| 
 |  
				| Hi All, 
 In my application I need to display localtime of the client and I used the below code snippet
 
 void  getCurrentDateTime(char *dateTimeString, int dateTimeStringLen) {
 
 time_t       temp;
 struct tm   *timeptr;
 
 temp = time(NULL);
 timeptr = localtime(&temp);
 strftime(dateTimeString,dateTimeStringLen,"%Om/%Od/%EY %T",timeptr);
 
 }
 
 Its displaying time always in GMT .
 Instead of that is that ok to use  __DATE__ and __TIME__ ?
 What is the difference btw localtime and the above macro( __DATE__ and __TIME__ ) ?
 
 
   
 Thanks in Advance.
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| DaveyC Moderator
 
  
 Joined: 02 Dec 2002
 Posts: 151
 Topics: 3
 Location: Perth, Western Australia
 
 | 
			
				|  Posted: Fri Jun 05, 2009 4:43 am    Post subject: |   |  
				| 
 |  
				| __DATE__ and __TIME__ are compiler generated timestamps. That's a terrible idea and you should abandon it right now. They're constants! 
 If this is to do with POSIX(ON) it's probably displaying GMT because your systems programmers haven't setup the TZ environment variable in /etc/profile correctly. Give them a prod.
 
 If you want to be consistent in both posix and non-posix environments you will have to chase control blocks and get the system time zone offset from the CVT extension block.
 _________________
 Dave Crayford
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		|  | 
	
		|  |