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 

To get localtime in MVS

 
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: Mon May 11, 2009 1:44 am    Post subject: To get localtime in MVS Reply with quote

I have a requirement to print local time from my C application and below code is used for the same. But, below snippet is printing GMT Time always rather local time.

Code:

void  getCurrentDateTime(char *dateTimeString, int dateTimeStringLen) {
 
    time_t       temp;
    struct tm   *timeptr;
 
    temp = time(NULL);
    timeptr = localtime(&temp);
    strftime(dateTimeString,dateTimeStringLen-1,"%Om/%Od/%EY %T",timeptr);
 
}


With reference to IBM's manual link (given below for reference), I understand that if POSIX(on) we need to setup the "TZ" environment variable else if POSIX(OFF) need to define LC_TOD to get the Time Zone for printing local time.

Can anyone help me how to find whether in MVS how to find POSIX is ON or OFF? Also, how to set TZ environment variable and LC_TOD?


http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/edclb190/3.553

Thanks in Advance,
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Mon May 11, 2009 10:36 am    Post subject: Reply with quote

deepthij,

In the same manual there is a link for setting the timezone

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/edclb190/3.1067?
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
deepthij
Beginner


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

PostPosted: Tue May 12, 2009 12:58 am    Post subject: Reply with quote

Hi,

Thanks for the reply. To set TZ variable we need to know whether POSIX is ON or OFF? by knowing this we can proceed with setting TZ variable.

Thanks,
Deepthi
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: Mon May 18, 2009 12:15 am    Post subject: Reply with quote

Try the __isPosixOn runtime function.
_________________
Dave Crayford
Back to top
View user's profile Send private message Send e-mail
DaveyC
Moderator


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

PostPosted: Mon May 18, 2009 12:20 am    Post subject: Reply with quote

BTW, the dateTimeStrLen-1 seems odd. the maxsize of the strftime takes the null terminator into account. So it's safe to use sizeof buffer for that parameter.
_________________
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