HPE Community read-only access December 15, 2018
This is a maintenance upgrade. You will be able to read articles and posts, but not post or reply.
Hours:
Dec 15, 4:00 am to 10:00 am UTC
Dec 14, 10:00 pm CST to Dec 15, 4:00 am CST
Dec 14, 8:00 pm PST to Dec 15, 2:00 am PST
Operating System - OpenVMS
cancel
Showing results for 
Search instead for 
Did you mean: 

Calculate GMT

 
SOLVED
Go to solution
Peter Zeiszler
Trusted Contributor

Calculate GMT

Hi,

Hoping someone has a quick fix/script for this. Trying to find a way to calculate the GMT value from the current systems' time and SYS$TIMEZONE_DIFFERENTIAL.

Anyone have a quick lexical that did this?
9 REPLIES
Hoff
Honored Contributor
Solution

Re: Calculate GMT

Assuming you're in an integer timezone (and not one of the zones with a fraction of an hour), try:

$ x=f$cvtim("+" + f$extract((f$integer(f$trnlnm("SYS$TIMEZONE_DAYLIGHT_SAVING"))*4+3),1,f$trnlnm("SYS$TIMEZONE_RULE")) +":","ABSOLUTE")


Re: Calculate GMT

>Hoff: not one of the zones with a fraction of an hour

Two of those would be India and Venezuela.
Hoff
Honored Contributor

Re: Calculate GMT

Yep, I'm aware of the fractional DSTs. And that the DCL code might not work so hot with a negative offset from GMT. Also of the rumor that the US might finally free itself of the DST idea, too.
Wim Van den Wyngaert
Honored Contributor

Re: Calculate GMT

Remark : "3" can also be more characters. The standard says 3 or more char (wrote that down many tears ago, source unknown).

Wim
Wim
Jan van den Ende
Honored Contributor

Re: Calculate GMT

Wim,

>>>
(wrote that down many tears ago
<<<

Litterally? Did you get hurt by it that much? :-)

Proost.

Have one on me.

jpe
Don't rust yours pelled jacker to fine doll missed aches.
Joseph Huber_1
Honored Contributor

Re: Calculate GMT

Hoffs DCL code, generalized for all time-zones
(at least I think so :-)

$dt3=-
f$extract((f$integer(f$trnlnm("SYS$TIMEZONE_DAYLIGHT_SAVING"))*4+3),-
3,f$trnlnm("SYS$TIMEZONE_RULE"))
$ dt2=f$extract(0,2,dt3)
$ dt1=f$extract(0,1,dt3)
$ if f$extract(0,1,dt1).eqs."-").or.(f$extract(0,1,dt1).eqs."+")
$ then
$ dt = dt2
$ else
$ dt="+"+dt1
$ if (f$extract(1,1,dt3).ges."0").and.-
(f$extract(1,1,dt3).les."9") then dt="+"+dt2
$ endif
$ if (f$extract(2,1,dt3).ges."0").and.(f$extract(2,1,dt3).les."9")
$ then
$ dt=dt3
$ endif
$ dt = dt+":"
$! show symbol dt
$ write sys$output f$cvtim(dt,"ABSOLUTE")

http://www.mpp.mpg.de/~huber
Joseph Huber_1
Honored Contributor

Re: Calculate GMT

Ah stupid cut'n'paste interface -
in the above proc., the line
$if f$extract(0,1,dt1).eqs."-").or.(f$extract(0,1,dt1).eqs."+")

has to be
$if (f$extract ...
http://www.mpp.mpg.de/~huber
Peter Zeiszler
Trusted Contributor

Re: Calculate GMT

Our support is moving to India now but the systems in question aren't located there.
I will play with the command files. Thanks.
Peter Zeiszler
Trusted Contributor

Re: Calculate GMT

The command file worked great - even for the systems overseas.