Sun Cluster 数据服务开发者指南(适用于 Solaris OS)

gettime 实用程序

gettime 实用程序是一种 C 程序, PROBE 程序用此 C 程序跟踪两次重新启动该探测程序的操作之间的时间间隔。您必须编译此程序并将其放置在与回调方法相同的目录中,即,由 RT_basedir 特性指定此目录。


实例 B–4 gettime.c 实用程序

#
# This utility program, used by the probe method of the data service, tracks
# 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>

main()
{
    printf(“%d\n”, time(0));
    exit(0);
}