OSF DCE Application Development Guide--Core Components

Chapter 21. DTS API Routines Programming
Example
This chapter contains a C programming example showing a practical application of the
DTS API programming routines. The program performs the following actions:
Prompts the user to enter two sets of time coordinates corresponding to the
timestamps of two ‘‘events.’’
Stores those coordinates in a tm structure.
Converts the tm structure to a utc structure.
Prints out the utc structure in ISO text format.
Determines which event occurred first.
Determines if Event 1 may have caused Event 2 by comparing the intervals.
#include time.h /* time data structures */
#include dce/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 : ");
124245 Tandem Computers Incorporated 211