Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Does anyone have a script that converts standard VMS time to epoch time? I'm writing a timestamp synchronizing script and it's easier to use epoch time to do the calculations.
Thanks.
Mike

Mike,
If you mean the actual binary OpenVMS time, then the operative question is what language are you writing in?
If you are working in DCL, what version of OpenVMS are you running? 7.3-2 has F$DELTA_TIME.
In all of the non-DCL languages, there are calls that will return the actual 64-bit binary time.
- Bob Gezelter, http://www.rlgsc.com

Well if the epoch means "Unix epoch time" time_t, then You may look into an example posted in comp.os.vms some years ago:

In a quick exercise I made a library routine from the above example program, which takes an input VMS quadword time, and returns the epoch:
http://wwwvms.mppmu.mpg.de/~huber/u...
If needed in a DCL script, You can easily build a program taking the VMS time string from the command-line, using the above routine to get epoch, put that into a DCL symbol (decimal until 2035, or better hexadezimal :-), so You can use it in the DCL procedure.

Yes, DCL. Sorry, still a newbie. I try to translate my Unix scripts to DCL and sometimes I get stumped. I have an epoch time calculator script that I've been trying to comnvert to DCL, but I'm having a rough time.
Thanks for all your ideas.Michael Ledesma
System Administrator
Petro Heating Oil Svc's

Mike,
First question: What version of OpenVMS is running on your system? As I mentioned, F$DELTA_TIME does a large part of what is wanted, without any fuss. However, it is a relatively new lexical function (I have not checked exhaustively, but it was introduced sometime between 7.0 and 7.3-2).
If you are running a version that supports F$DELTA_TIME, you can create a "date since epoch" by doing a delta time from the epochal date (so long as it is past the OpenVMS epochal date of 17 November 1858; see the System Services reference manual for the date format). The datetime can be converted into a easily processed form using the F$CVTIME lexical function.
- Bob Gezelter, http://www.rlgsc.com

Hey, Bob.
We're running OpenVMS V7.3-2 , so it should work. I'll look into it immediately.
Thanks a bunch!
MikeMichael Ledesma
System Administrator
Petro Heating Oil Svc's

Mike,
My pleasure. It was nothing.
If we can be of additional assistance, please feel free to contact me, either in the forum, or privately.
- Bob Gezelter, http://www.rlgsc.com

Bob, ( & Mike )
F$DELTA_TIME() has its limitations.
OpenVMS has only four digits for the number of days in a delta-time.9999 days is roughly 27 years.
But you will get a
%SYSTEM-F-IVTIME, invalid time
if you are ouside the boundary.
Not a userfriendly errormessage....regards,
Hakan Zanderau

Hakan,
If you have a support contract, I suggest that you submit that comment to the appropriate channels (or bring it to the attention of the engineering group in some other fashion).
This is not a problem with the underlying format, it is an issue with the conversion routine to/from ASCII. The underlying format of the information is the 64-bit time/date binary, with the unit being microforthnights.
- Bob Gezelter, http://www.rlgsc.com

![]() |
![]() |
![]() |
| Login or Register to Reply | |
| Login | Register |
| Ads by Google |