Converts a binary OpenVMS format time and TDF (expressing the
time in an arbitrary time zone) to a binary timestamp.
Format
#include <utc.h>
int utc_mkvmsanytime(*utc, *timadr, tdf)
utc_t *utc;
const long *timadr;
const long tdf;
1 – Parameters
Input
*timadr
Binary OpenVMS format time.
tdf
Time differential factor to use in conversion.
Output
*utc
Binary timestamp.
2 – Description
The Make VMS Any Time routine converts a binary time in the
OpenVMS (Smithsonian) format and an arbitrary TDF to a UTC-based
binary timestamp. Because the input and output values are based
on different time standards, any input representing a value after
A.D. 30,000 returns an error.
3 – Returns
0 Indicates that the routine executed successfully.
-1 Indicates an invalid time argument or invalid results.
4 – Example
The following example shows how to convert between OpenVMS format
binary timestamps and UTC binary timestamps, while specifying the
TDF for each. The TDF value determines the offset from GMT and
the local time.
/*****
start example mkvmsanytime,vmsanytime
*****/
#include <utc.h>
main()
{
struct utc utcTime;
int vmsTime[2];
SYS$GETTIM(vmsTime); /* read the current time */
/*
* convert the VMS local time to a UTC, applying a TDF of
* -300 minutes (the timezone is -5 hours from GMT)
*/
if (utc_mkvmsanytime(&utcTime,vmsTime,-300))
exit(1);
/*
* convert UTC back to VMS local time. A TDF of -300 is applied
* to the UTC, since utcTime was constructed with that same value.
* This effectively gives us the same VMS time value we started
* with.
*/
if (utc_vmsanytime(vmsTime,&utcTime))
exit(2);
}
/****
end example
****/
5 – Related Functions
Function: utc_vmsanytime