|
On Wed, 29 Oct 2003, James Rich wrote: > > Notice "on some architectures". Most likely is that the timezone > structure is not filled out on the iSeries platform. If so, this is not > a bug. Do you know for a fact that this is the reason, or is it just a guess? When I look in the iSeries Information Center, I see this: tzp (Output) A pointer to a timezone structure that contains the local time zone (measured in minutes of time westward from Greenwich) and a flag that, if nonzero, indicates daylight saving time applies locally during the appropriate part of the year. It says NOTHING about the time zone not being filled in, despite that this is an iSeries-specific manual. In fact, there's an example at the end of this page which shows output like this: Example Output: gettimeofday() successful. time = 866208142.290944, minuteswest = 360, dsttime = 1 Why would IBM put an example in their own iSeries manual that shows the timezone being returned if they don't support it? Something isn't right here. Either their documentation is really really misleading, or something else is wrong, here.. > It isn't filled out on linux either (and I don't think it is on > *BSD). Correct, it's not used in FreeBSD (I don't know about the other BSDs) but the manual page for FreeBSD clearly tells you that. > gettimeofday() is designed to tell what time the software clock > thinks it is, not necessarily what timezone you are in. The time value > in struct *tv is already adjusted for your timezone. No, it's not. The time returned by gettimeofday() is the seconds from Jan 1 1970, UTC, NOT the local time. This is documented in the Infocenter as well, but I also tested it with a quick program... Here's my test program, I deliberately coded this so that it would work on V4R2 or later (since that's when the API was introduced). On my system, it returns the UTC time and 0 for the minutes west. H DFTACTGRP(*NO) BNDDIR('QC2LE') D tv ds D tv_sec 10U 0 D tv_usec 10I 0 D tz ds D tz_minwest 10I 0 D tz_dstttime 10I 0 D gettimeofday PR 10I 0 ExtProc('gettimeofday') D tp * value D tzp * value D ts s Z D msg s 52A D showts s 26a D rc s 10I 0 c eval rc = gettimeofday(%addr(tv): %addr(tz)) c if rc < 0 c eval Msg = 'gettimeofday() failed.' c dsply Msg c else c eval ts = z'1970-01-01-00.00.00' c adddur tv_sec:*S ts c eval Msg = 'You are ' + %char(tz_minwest) + c ' minutes west of UTC' c dsply msg c move ts showts c eval Msg = 'it is ' + showts c dsply msg c endif c eval *inlr = *on
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.