Sun Cluster 3.1 Data Services Developer's Guide

gettime Utility Code Listing

The gettime utility is a C program used by the PROBE program to track the elapsed time between restarts of the probe. You must compile this program and place it in the same directory as the callback methods, that is, the directory pointed to by the RT_basedir property.

Example B–4 gettime.c utility program

# This utility program, used by the probe method of the data service,
# the elapsed time in seconds from a known reference point (epoch
point). It
# must be compiled and placed in the same directory as the data
service callback
# methods (RT_basedir).

#pragma ident   “@(#)gettime.c   1.1   00/05/24 SMI”

#include <stdio.h>
#include <sys/types.h>
#include <time.h>

    printf(“%d\n”, time(0));