* getting correct local time in VAX C program
@ 1996-03-28 5:00 David Raffel
1996-03-31 5:00 ` Carl J Lydick
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: David Raffel @ 1996-03-28 5:00 UTC (permalink / raw)
I'm having a problem using the c localtime function to convert a
"timestamp" (represented in seconds since 1/1/1970) to a date
and time. I'm running under VMS V5.5-2 and using VAXC V3.1.
The problem is that the timestamp is being written out to a file
by a SUN which takes into account timezone information. When I
read the timestamp on VMS and convert it, I get the correct date,
but the time is off by 5 hours. I assume that this is because
the VAX doesn't use any timezone information and always returns
GMT.
When I call time() to get the current time in seconds, the
time returned on VMS is different by 18000 seconds from the
time returned on the SUN.
Are there any routines available that will return the correct
local time, or any suggestions for how I can get the correct
time?
Thanks!
David Raffel
raffel@umich.edu
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: getting correct local time in VAX C program
1996-03-28 5:00 getting correct local time in VAX C program David Raffel
@ 1996-03-31 5:00 ` Carl J Lydick
1996-04-02 5:00 ` Stephen Hoffman
1996-05-10 4:00 ` Andy J Robb
2 siblings, 0 replies; 4+ messages in thread
From: Carl J Lydick @ 1996-03-31 5:00 UTC (permalink / raw)
In article <4jec36$ff3@lastactionhero.rs.itd.umich.edu>, raffel@umich.edu (David Raffel) writes:
=
=I'm having a problem using the c localtime function to convert a
="timestamp" (represented in seconds since 1/1/1970) to a date
=and time. I'm running under VMS V5.5-2 and using VAXC V3.1.
=
=The problem is that the timestamp is being written out to a file
=by a SUN which takes into account timezone information. When I
=read the timestamp on VMS and convert it, I get the correct date,
=but the time is off by 5 hours. I assume that this is because
=the VAX doesn't use any timezone information and always returns
=GMT.
=
=When I call time() to get the current time in seconds, the
=time returned on VMS is different by 18000 seconds
That's 5 hours, by the way.
=from the
=time returned on the SUN.
=
=Are there any routines available that will return the correct
=local time, or any suggestions for how I can get the correct
=time?
#include descrip
#define ckstat(x) if (((stat = x) & 7) != 1) SYS$EXIT(stat)
main()
{ unsigned long timadr[2], stat, SYS$EXIT(), SYS$GETTIM(), SYS$ASCTIM();
void puts();
char buffer[33];
$DESCRIPTOR(timbuf, buffer);
ckstat(SYS$GETTIM(timadr));
ckstat(SYS$ASCTIM(&timbuf.dsc$w_length, &timbuf, timadr, 0));
buffer[timbuf.dsc$w_length] = '\0';
puts(buffer);
}
--------------------------------------------------------------------------------
Carl J Lydick | INTERnet: CARL@SOL1.GPS.CALTECH.EDU | NSI/HEPnet: SOL1::CARL
Disclaimer: Hey, I understand VAXen and VMS. That's what I get paid for. My
understanding of astronomy is purely at the amateur level (or below). So
unless what I'm saying is directly related to VAX/VMS, don't hold me or my
organization responsible for it. If it IS related to VAX/VMS, you can try to
hold me responsible for it, but my organization had nothing to do with it.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: getting correct local time in VAX C program
1996-03-28 5:00 getting correct local time in VAX C program David Raffel
1996-03-31 5:00 ` Carl J Lydick
@ 1996-04-02 5:00 ` Stephen Hoffman
1996-05-10 4:00 ` Andy J Robb
2 siblings, 0 replies; 4+ messages in thread
From: Stephen Hoffman @ 1996-04-02 5:00 UTC (permalink / raw)
In article <4jec36$ff3@lastactionhero.rs.itd.umich.edu>, raffel@umich.edu (David Raffel) writes:
:Are there any routines available that will return the correct
:local time, or any suggestions for how I can get the correct
:time?
VAX C V3.1 is a veritable antique by present standards -- V3.2 is five
or six years old. The current C compiler for OpenVMS VAX is DEC C, and
V5.2 is the current release. (Both VAX C V3.2 and DEC C can coexist on
the same OpenVMS VAX system, and both are enabled with the "C" license.
DEC C requires a run-time kit -- in the distribution directory with the
DEC C compiler -- for OpenVMS V5.5 through V6.0 inclusive. The run-time
kit is not necessary on and should not be installed on V6.1 or later.)
DEC C V5.2 and OpenVMS V7.0 do include timezone support -- the VAX C
compiler does not. (OpenVMS V6.0 and later include the RTL support for
UTC and similar, and much of the underpinnings necessary for solving
this problem are present starting in that release -- gmtime and friends
first return non-zero values on OpenVMS V7.0.)
Prior to the V5.2/V7.0 release, you will need to implement the TDF
calculations yourself. This task is easiest on V6.0 and later, as the
services are available.
------------------------- pure personal opinion ---------------------------
Stephen Hoffman OpenVMS Engineering hoffman@xdelta.enet.dec.com
---------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: getting correct local time in VAX C program
1996-03-28 5:00 getting correct local time in VAX C program David Raffel
1996-03-31 5:00 ` Carl J Lydick
1996-04-02 5:00 ` Stephen Hoffman
@ 1996-05-10 4:00 ` Andy J Robb
2 siblings, 0 replies; 4+ messages in thread
From: Andy J Robb @ 1996-05-10 4:00 UTC (permalink / raw)
raffel@umich.edu (David Raffel) wrote:
>I'm having a problem using the c localtime function to convert a
>"timestamp" (represented in seconds since 1/1/1970) to a date
>and time. I'm running under VMS V5.5-2 and using VAXC V3.1.
>The problem is that the timestamp is being written out to a file
>by a SUN which takes into account timezone information. When I
>read the timestamp on VMS and convert it, I get the correct date,
>but the time is off by 5 hours. I assume that this is because
>the VAX doesn't use any timezone information and always returns
>GMT.
I have seen reference to DEC machines using localtime in response to
TCP/ICMP timestamp packets without setting the high bit as required.
From this, I suspect that DEC expects the clock to be localtime.
Thus, the Sun will respond to an rdate type request with UTC (aka GMT)
and DEC will use it as localtime (I think, perhaps, possibly ...)
Regards,
Andy Robb.
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: 2.6.2i
mQCNAy/MpRwAAAEEAOt6uBYqT8yv9EmqNhK8m6v+bYi8QjnGW3Bo6iU1gsMj5pa6
MHgq99c8deADbE3cbJ6uZS9v5pZE3WCf6HCQjlB5iULA5RZzMdAumd/WUzuL9UT3
B44D9EqqFIL79FlYb56v4oKFqFp1/J2bIpYUwnUvabGzGjdLrpPl4P16x9sNAAUR
tCNBbmR5IEogUm9iYiA8QUpSb2JiQHBhdmlsaW9uLmNvLnVrPrQhQW5keSBSb2Ji
IDxBSlJvYmJAcGF2aWxpb24uY28udWs+
=/wVD
-----END PGP PUBLIC KEY BLOCK-----
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~1996-05-10 4:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1996-03-28 5:00 getting correct local time in VAX C program David Raffel
1996-03-31 5:00 ` Carl J Lydick
1996-04-02 5:00 ` Stephen Hoffman
1996-05-10 4:00 ` Andy J Robb
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox