Post by Stephen HoffmanPost by Jon PinkleyBut unfortunately, you must need to be using DECnet-Plus. Why they
don't mention this until the end where it has (with invalid cc /output=
instead of /object=)
Log some feedback with VSI, if that's still the case with the current
manuals and current VSI software.
The DECdts callable routines have been integrated with and shipped as
part of OpenVMS for most of two decades. I had the related API doc
moved from the DECnet-Plus manuals to the OpenVMS manuals and that then
first (re)published in the OpenVMS V8.2 docs IIRC, but the routines
were migrated earlier; with the integration of the timezone and related
timekeeping support at OpenVMS V7.3.
https://groups.google.com/d/msg/comp.os.vms/e7PzJ1W3eSs/0Hua0U2VrBYJ
Post by Jon PinkleyI found some old threads with a search for "DECdts" on google groups.
They said that DECdts is included after 7.3-2, and the system has
sys$library:dtss$shr.exe, but I can't find utc.h to #include
The separate header files are for reference, and moderately-old C
stopped extracting the header files from the system definitions. See
the libext tool on the Freeware, as I got that code open-sourced when
the compilers stopped offering to extract the header files into the
reference directories. The compilers do look in the proper spot for
headers. But if you don't have the utc.h file around in the C header
text libraries (I don't have anything running as far back as you seem
to be using), you're left to back-port that or to upgrade OpenVMS to
something approaching current OpenVMS.
--
Pure Personal Opinion | HoffmanLabs LLC
I extracted the example from help on eisner, pasted into eve editor, converted tabs to spaces, used box select and box cut insert to remove the leading blanks, changed the command to /object= and put in comment.
It works the same on Eisner running VSI 8.4-1L2, here's a log.
I must be doing something wrong.
(void)scanf("%d",&tmTime.tm_min);
(void)printf("Inacc Secs? ");
(void)scanf("%d",&tmInacc.tm_sec);
if (utc_mkanytime(utcTime,
&tmTime,
(long)0,
&tmInacc,
(long)0,
(long)0))
exit(1);
}
/*
Assume the preceding program is named compare_events.c. To
compile and link the program on a DECnet-Plus for OpenVMS system,
enter the following command:
$ cc compare_events.c/object=compare_events.obj
$ link compare_events.obj, sys$input:/options<Return>
sys$library:dtss$shr.exe/share<Ctrl-z>
$
*/
[End of file]
Buffer: COMPARE_EVENTS.C | Write | Insert | Forward
126 lines written to file USR_SCRATCH:[PINKLEY]COMPARE_EVENTS.C;4
$ sho log decc*
(LNM$PROCESS_TABLE)
(LNM$JOB_81F57700)
(LNM$GROUP_000030)
(LNM$SYSTEM_TABLE)
"DECC$CRTLMAP" = "SYS$SHARE:DECC$SHR_EV56"
"DECC$SHR" = "SYS$SHARE:DECC$SHR_EV56"
(LNM$SYSCLUSTER_TABLE)
(DECW$LOGICAL_NAMES)
$ cc/ver
VSI C V7.4-002 on OpenVMS Alpha V8.4-2L2
$ tail USR_SCRATCH:[PINKLEY]COMPARE_EVENTS.C
(void)scanf("%d",&tmTime.tm_hour);
(void)printf("Minute? ");
(void)scanf("%d",&tmTime.tm_min);
(void)printf("Inacc Secs? ");
(void)scanf("%d",&tmInacc.tm_sec);
if (utc_mkanytime(utcTime,
&tmTime,
(long)0,
&tmInacc,
(long)0,
(long)0))
exit(1);
}
/*
Assume the preceding program is named compare_events.c. To
compile and link the program on a DECnet-Plus for OpenVMS system,
enter the following command:
$ cc compare_events.c/object=compare_events.obj
$ link compare_events.obj, sys$input:/options<Return>
sys$library:dtss$shr.exe/share<Ctrl-z>
$
*/
$ cc compare_events.c/object=compare_events.obj
#include <utc.h> /* utc structure definitions */
.^
%CC-F-NOINCLFILEF, Cannot find file <utc.h> specified in #include directive.
at line number 2 in file USR_SCRATCH:[PINKLEY]COMPARE_EVENTS.C;4
$ help/nopage decdts example
DECDTS
Example
The following C programming example shows a practical application
of the DECdts API programming routines. The program performs the
following actions:
o Prompts the user to enter time coordinates.
o Stores those coordinates in a tm structure.
o Converts the tm structure to a utc structure.
o Determines which event occurred first.
o Determines if Event 1 may have caused Event 2 by comparing the
intervals.
o Prints out the utc structure in ISO text format.
#include <time.h> /* time data structures */
#include <utc.h> /* utc structure definitions */
void ReadTime();
void PrintTime();
/*
* This program requests user input about events, then prints out
* information about those events.
*/
main()
{
struct utc event1,event2;
enum utc_cmptype relation;
/*
* Read in the two events.
*/
ReadTime(&event1);
ReadTime(&event2);
/*
* Print out the two events.
*/
printf("The first event is : ");
PrintTime(&event1);
printf("\nThe second event is : ");
PrintTime(&event2);
printf("\n");
/*
* Determine which event occurred first.
*/
if (utc_cmpmidtime(&relation,&event1,&event2))
exit(1);
switch( relation )
{
case utc_lessThan:
printf("comparing midpoints: Event1 < Event2\n");
break;
case utc_greaterThan:
printf("comparing midpoints: Event1 > Event2\n");
break;
case utc_equalTo:
printf("comparing midpoints: Event1 == Event2\n");
break;
default:
exit(1);
break;
}
/*
* Could Event 1 have caused Event 2? Compare the intervals.
*/
if (utc_cmpintervaltime(&relation,&event1,&event2))
exit(1);
switch( relation )
{
case utc_lessThan:
printf("comparing intervals: Event1 < Event2\n");
break;
case utc_greaterThan:
printf("comparing intervals: Event1 > Event2\n");
break;
case utc_equalTo:
printf("comparing intervals: Event1 == Event2\n");
break;
case utc_indeterminate:
printf("comparing intervals: Event1 ? Event2\n");
default:
exit(1);
break;
}
}
/*
* Print out a utc structure in ISO text format.
*/
void PrintTime(utcTime)
struct utc *utcTime;
{
char string[50];
/*
* Break up the time string.
*/
if (utc_ascgmtime(string, /* Out: Converted time */
50, /* In: String length */
utcTime)) /* In: Time to convert */
exit(1);
printf("%s\n",string);
}
/*
* Prompt the user to enter time coordinates. Store the
* coordinates in a tm structure and then convert the
* tm structure to a utc structure.
*/
void ReadTime(utcTime)
struct utc *utcTime;
{
struct tm tmTime,tmInacc;
(void)memset((void *)&tmTime, 0,sizeof(tmTime));
(void)memset((void *)&tmInacc, 0,sizeof(tmInacc));
(void)printf("Year? ");
(void)scanf("%d",&tmTime.tm_year);
tmTime.tm_year -= 1900;
(void)printf("Month? ");
(void)scanf("%d",&tmTime.tm_mon);
tmTime.tm_mon -= 1;
(void)printf("Day? ");
(void)scanf("%d",&tmTime.tm_mday);
(void)printf("Hour? ");
(void)scanf("%d",&tmTime.tm_hour);
(void)printf("Minute? ");
(void)scanf("%d",&tmTime.tm_min);
(void)printf("Inacc Secs? ");
(void)scanf("%d",&tmInacc.tm_sec);
if (utc_mkanytime(utcTime,
&tmTime,
(long)0,
&tmInacc,
(long)0,
(long)0))
exit(1);
}
Assume the preceding program is named compare_events.c. To
compile and link the program on a DECnet-Plus for OpenVMS system,
enter the following command:
$ cc compare_events.c/output=compare_events.obj
$ link compare_events.obj, sys$input:/options<Return>
sys$library:dtss$shr.exe/share<Ctrl-z>
$
Topic? Exit
$