T.R | Title | User | Personal Name | Date | Lines |
---|
106.1 | REFORMATTED TO 80 COLS | HNDYMN::MCCARTHY | A Quinn Martin Production | Wed Jan 29 1997 10:04 | 25 |
| I am a developer of a Web Server Extension program (ISAPI, NSAPI, & CGI) which
is being delivered on OpenVMS, DIGITAL Unix, and Windows32.
As part of the functionality we need to send the current time to the Web
Browser in GMT format.
This is fine on Windows32 and DIGITAL Unix, as I can use the C Run Time
function gmtime. However, this function does not work on OpenVMS.
So I started to look at SYS$GETUTC to return a UTC (or GMT by another name)
time.
However, the three other UTC calls, SYS$NUMUTC, SYS$ASCUTC, SYS$BINUTC seem to
insist that the date/time must be given/returned in local time.
So what I would like to do is interpret the 128 bit UTC time, and convert it
into a 'C' tm structure, so that I can write a function to mimick the
behaviour of gmtime.
Are all the above statements true (on OpenVMS 6.2 upwards), and if so, could I
get some help with the UTC 128 bit date/time structure.
Thanks,
Steve
|
106.2 | try TURRIS::DECC | HNDYMN::MCCARTHY | A Quinn Martin Production | Wed Jan 29 1997 10:06 | 10 |
| >>So what I would like to do is interpret the 128 bit UTC time, and convert it
>>into a 'C' tm structure, so that I can write a function to mimick the
>>behaviour of gmtime.
I suggest you ask this question in turris::decc
gmtime is avaiable as of V6.1 of OpenVMS. You don't mention what else is
missing or what version of OpenVMS is your target.
bjm
|
106.3 | DEC C Question -- See C RTL Listings | XDELTA::HOFFMAN | Steve, OpenVMS Engineering | Wed Jan 29 1997 10:18 | 20 |
|
This is more specifically a DEC C question, as was mentioned...
The various UTC system services were added in OpenVMS V6.0.
The OpenVMS version when a particular C RTL call was added is
listed in the following table:
http://hndymn.zko.dec.com/~crtl/when_functions_were_released.html
You will want to avoid parsing the contents of the binary UTC format.
(There doesn't seem to be a standard for the binary format of UTC --
the UTC text formats are specified quite carefully, however.)
Failing the availability of the DEC C RTL calls, I'd look at using
sys$numutc, and/or the other RTL services -- see the "Time" chapter
in the programming concepts manual for some information that may
interest you. (The LIB Run-Time Library (RTL) contains various
user-programmable date-time formatting routines, routines such as
LIB$CONVERT_DATE_STRING.)
|
106.4 | | AUSS::GARSON | DECcharity Program Office | Wed Jan 29 1997 18:00 | 6 |
| re .0
I recall someone else noticing the lack of support for other than local
time zone. (That person was also threatening carnal knowledge of the
128-bit format and my recollection is that the recommendation was "Just
say 'No'".) I suggest that you look in old versions of VMSNOTES.
|
106.5 | yet another possibility | COMEUP::SIMMONDS | lock (M); while (not *SOMETHING) { Wait(C,M); } unlock(M) | Wed Jan 29 1997 23:21 | 6 |
| Re: .0
If the OpenVMS node has DECnet-Plus installed, then you could just call
utc_ascgmtime() [see the DECnet-Plus DECdts Programming manual]
John.
|
106.6 | Time differentiate factor logical | TAVENG::BORIS | Boris Gubenko, ISE | Thu Jan 30 1997 09:50 | 88 |
|
I think, "real" gmtime() function, returning a pointer to a tm structure
which contains broken-down time expressed as UTC, became avaiable beginning
with OpenVMS V7.0. Prior to V7.0, this function always returns a NULL
pointer.
On OpenVMS 6.0, 6.1 and 6.2 you can use exec-mode SYS$TIMEZONE_DIFFERENTIAL
logical from LNM$SYSTEM_TABLE table to calculate UTC. This logical is set to
contain the time differentiate factor (TDF) which is the difference in
seconds between the local system time and UTC.
To mimick the behaviour of gmtime() on V6.?, you can do the following:
. translate SYS$TIMEZONE_DIFFERENTIAL logical
. call the time() function and subtract from the returned value the
value of SYS$TIMEZONE_DIFFERENTIAL. The result will present the
number of seconds since Epoch for UTC
. pass the result to the localtime() function to obtain broken-down
time in the form of the tm structure. The result will be as if the
gmtime() was called for the original returned value of the time()
function
Boris
Example
=======
(LNM$SYSTEM_TABLE) [kernel] [shareable,system]
[Protection=(RWC,RWC,R,R)] [Owner=[SYSTEM]]
"SYS$TIMEZONE_DIFFERENTIAL" [exec] = "-18000"
#include <stdio.h>
#include <time.h>
#define TDF (-18000)
static void display_tm(struct tm *tm_ptr);
main()
{
time_t timer;
struct tm *tm_ptr;
timer = time(NULL);
tm_ptr = localtime(&timer);
printf("\nLocal Time:\n");
display_tm(tm_ptr);
timer -= TDF;
tm_ptr = localtime(&timer);
printf("\nGMT:\n");
display_tm(tm_ptr);
}
static void display_tm(struct tm *tm_ptr)
{
printf("tm_ptr->tm_sec = %d\n", tm_ptr->tm_sec );
printf("tm_ptr->tm_min = %d\n", tm_ptr->tm_min );
printf("tm_ptr->tm_hour = %d\n", tm_ptr->tm_hour);
printf("tm_ptr->tm_mday = %d\n", tm_ptr->tm_mday);
printf("tm_ptr->tm_mon = %d\n", tm_ptr->tm_mon );
printf("tm_ptr->tm_year = %d\n", tm_ptr->tm_year);
printf("tm_ptr->tm_wday = %d\n", tm_ptr->tm_wday);
printf("tm_ptr->tm_yday = %d\n", tm_ptr->tm_yday);
}
Local Time:
tm_ptr->tm_sec = 27
tm_ptr->tm_min = 33
tm_ptr->tm_hour = 8 <<<<<<<<<<<<<<
tm_ptr->tm_mday = 30
tm_ptr->tm_mon = 0
tm_ptr->tm_year = 97
tm_ptr->tm_wday = 4
tm_ptr->tm_yday = 29
GMT:
tm_ptr->tm_sec = 27
tm_ptr->tm_min = 33
tm_ptr->tm_hour = 13 <<<<<<<<<<<<<<
tm_ptr->tm_mday = 30
tm_ptr->tm_mon = 0
tm_ptr->tm_year = 97
tm_ptr->tm_wday = 4
tm_ptr->tm_yday = 29
|
106.7 | | AUSS::GARSON | DECcharity Program Office | Thu Jan 30 1997 17:01 | 11 |
| re .6
> . call the time() function and subtract from the returned value the
> value of SYS$TIMEZONE_DIFFERENTIAL.
How does this logical name get set? On both my systems it is -46800
which looks invalid to me.
P.S. For quick hacks
int tdf = atoi(getenv("SYS$TIMEZONE_DIFFERENTIAL"));
|
106.8 | UTC$CONFIGURE_TDF | XDELTA::HOFFMAN | Steve, OpenVMS Engineering | Thu Jan 30 1997 17:22 | 13 |
|
:> . call the time() function and subtract from the returned value the
:> value of SYS$TIMEZONE_DIFFERENTIAL.
:
: How does this logical name get set?
One can set and show it with SYS$MANAGER:UTC$CONFIGURE_TDF.COM
: On both my systems it is -46800 which looks invalid to me.
Where (when? :-) are you? The TDF value is in seconds, relative
to GMT.
|
106.9 | | QUARK::LIONEL | Free advice is worth every cent | Thu Jan 30 1997 20:48 | 4 |
| -46800 is the value used when the timezone has not been set up. It's
equivalent to -13:00.
Steve
|