View previous topic :: View next topic |
Author |
Message |
deepthij Beginner
Joined: 08 May 2009 Posts: 13 Topics: 6 Location: Bangalore
|
Posted: Mon May 11, 2009 1:44 am Post subject: To get localtime in MVS |
|
|
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 |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
|
Back to top |
|
 |
deepthij Beginner
Joined: 08 May 2009 Posts: 13 Topics: 6 Location: Bangalore
|
Posted: Tue May 12, 2009 12:58 am Post subject: |
|
|
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 |
|
 |
DaveyC Moderator

Joined: 02 Dec 2002 Posts: 151 Topics: 3 Location: Perth, Western Australia
|
Posted: Mon May 18, 2009 12:15 am Post subject: |
|
|
Try the __isPosixOn runtime function. _________________ Dave Crayford |
|
Back to top |
|
 |
DaveyC Moderator

Joined: 02 Dec 2002 Posts: 151 Topics: 3 Location: Perth, Western Australia
|
Posted: Mon May 18, 2009 12:20 am Post subject: |
|
|
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 |
|
 |
|
|