MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Regarding __date__ __time__ and localtime in Z/OS

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
deepthij
Beginner


Joined: 08 May 2009
Posts: 13
Topics: 6
Location: Bangalore

PostPosted: Fri Jun 05, 2009 1:39 am    Post subject: Regarding __date__ __time__ and localtime in Z/OS Reply with quote

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__ ) ?

Shocked

Thanks in Advance.
Back to top
View user's profile Send private message
DaveyC
Moderator


Joined: 02 Dec 2002
Posts: 151
Topics: 3
Location: Perth, Western Australia

PostPosted: Fri Jun 05, 2009 4:43 am    Post subject: Reply with quote

__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
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group