Operating System - OpenVMS
cancel
Showing results for 
Search instead for 
Did you mean: 

UTC 0 <-> Locatime conversions

 
SOLVED
Go to solution
Brian Reiter
Valued Contributor

UTC 0 <-> Locatime conversions

Hi Folks,

Hopefully this will be simple to solve. Does VMS have support (via system services etc.) to convert local times to a UTC 0 time (and vice versa). The various UTC conversions in the system services seem to use the current TDF, fine at the moment but not so good when requests span a BST-GMT or GMT-BST transition.

I know the CRTL should support this, but I'd rather not go the route of calling the CRTL from Pascal if I can help it.

The system (VMS 7-3-2) is synched to a NTP server and the TDF has been setup to give the correct local time. We have been asked to report all system events (application detected) to another system in UTC 0. However the system still needs to report local time to the operators (as well as converting operator requests to event information from UTC0 to local time).

Any clues would be appreciated.

Best Regards


Brian
8 REPLIES
Ian Miller.
Honored Contributor

Re: UTC 0 <-> Locatime conversions

I don't know if the TDF part of the 128 bit UTC format returned by GETUTC etc is documented but it must be in there somehow. Try looking at it has two vms 64 bit format times - parhaps one of them is the TDF as a delta time.
____________________
Purely Personal Opinion
Brian Reiter
Valued Contributor

Re: UTC 0 <-> Locatime conversions

Ian,

The TDF can be examined by calling $NUMUTC. However the TDF is always seems to be set to the current offset (BST in this case). Converting a time (say 1-Jan-2005) where I would I could expect a TDF 0 (done via $ASCUTC and $NUMUTC) gives the current TDF.

FWIW interpreting a UTC time as two VMS times doesn't help.

cheers

Brian
Kris Clippeleyr
Honored Contributor

Re: UTC 0 <-> Locatime conversions

Hi Brian,

Have a look at the $TIMCON and $NUMUTC system services. $TIMCON converts a 64-bit date/time quadword to 128-bit UTC format.
$NUMUTC takes the 128-bit UTC datum, and cuts it into pieces (year, month_of_year, etc.) The last word of that struct is the TDF in minutes.

Hope this helps,
Kris (aka Qkcl)
I'm gonna hit the highway like a battering ram on a silver-black phantom bike...
Volker Halle
Honored Contributor

Re: UTC 0 <-> Locatime conversions

Brian,

according to the system services documentation, whenever the output time format is UTC, 'the timezone of the local system is used'.

Volker.
Volker Halle
Honored Contributor
Solution

Re: UTC 0 <-> Locatime conversions

Brian,

did you look at the DECdts Portable API routines described in the Utility Routines Manual ? They seem to supply all kinds of routines to convert time between various different time structures.

Volker.
Brian Reiter
Valued Contributor

Re: UTC 0 <-> Locatime conversions

Hi Volker,

Forgot all about that manual - so used to just having to use the System Service and RLT LIB manuals on a daily basis.

Best regards

Brian
Kris Clippeleyr
Honored Contributor

Re: UTC 0 <-> Locatime conversions

Brian,

As an attachment a little C program that does convert from local time to UTC (written in C).

Greetz,
Kris (aka Qkcl)
I'm gonna hit the highway like a battering ram on a silver-black phantom bike...
Brian Reiter
Valued Contributor

Re: UTC 0 <-> Locatime conversions

Hi Folks,

Got the routines I need now - just constructing the Pascal prototypes and doing testing them to verify that it will all work correctly.

Thanks very much for your help


regards

Brian