Thanks @John, good points that I failed to cover in my OP.

The application runs POSIX(ON) (hence my reference to TZ [no underscore]) and 
yes, issues the code below with no error reported.

    int seRes = 0;
    seRes = setenv("TZ", Time_TZset.c_str(), 1);
    if (seRes != 0) Msg::Print(&Msg::Msgs[260], strerror(errno));      // "160E 
Error returned from setenv(\"TZ\"); time functions may not work correctly: %1$s

Charles

-----Original Message-----
From: IBM Mainframe Discussion List [mailto:[email protected]] On Behalf 
Of John McKown
Sent: Thursday, November 03, 2016 12:05 PM
To: [email protected]
Subject: Re: Question on TZ and European time change

On Thu, Nov 3, 2016 at 1:29 PM, Charles Mills <[email protected]> wrote:

> I am supporting a customer in Europe. They are reporting that the 
> timestamps in our messages -- which are produced from the C library 
> routines
> gettimeofday64() + localtime64() -- were correct during the summer but 
> did not change to standard time this past weekend. TZ is apparently 
> set to 'CET-1CEST' (without the quotes).
>
> What should I be looking for?
>
> Thanks,
>
> Charles
>
>
​I don't have a way to test this readily, but reading about
gettimeofday64() from

http://www.ibm.com/support/knowledgecenter/SSLTBW_2.1.0/com.ibm.zos.v2r1.bpxbd00/gettmdy.htm

it appears that gettimeofday64() does not do a tzset() automatically (whereas 
gettimeofday does, but if and only if _ALL_SOURCE is #DEFINEd).

For localtime64(), from
http://www.ibm.com/support/knowledgecenter/SSLTBW_2.1.0/com.ibm.zos.v2r1.bpxbd00/localt.htm
If your application runs POSIX(ON), then it should honor TZ. But if it run 
POSIX(OFF), then _TZ (leading underscore) is required.
also:
[quote]
The localtime() function converts calendar time (that is, seconds elapsed since 
the epoch) to broken-down time, expressed as local time, using time zone 
information provided by the TZ or _TZ environment variable or the LC_TOD 
category of the current locale:

   - When neither TZ nor _TZ is defined, the current locale is interrogated
   for time zone information. If neither TZ nor _TZ is defined and LC_TOD time
   zone information is not present in the current locale, a default value is
   applied to local time. POSIX programs simply default to Coordinated
   Universal Time (UTC), while non-POSIX programs establish an offset from UTC
   based on the setting of the system clock. For more information about
   customizing a time zone to work with local time, see “Customizing a time
   zone” in z/OS XL C/C++ Programming Guide
   
<http://www.ibm.com/support/knowledgecenter/en/SSLTBW_2.1.0/com.ibm.zos.v2r1.cbcpx01/cbc1p200.htm?view=kc>
   .

​[quote/]​

​Perhaps your code needs to an explicit tzset() before invoking
gettimeofday64() or localtime64(), but I don't really know.


--
Heisenberg may have been here.

Unicode: http://xkcd.com/1726/

Maranatha! <><
John McKown

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions, send email to 
[email protected] with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to