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

gettime 公用程序

gettime 公用程序是一个 C 程序,PROBE 程序用于跟踪两次重新启动探测之间的时间间隔。 您必须编译此程序并将其放置在与回叫方法相同的目录中,即,由 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);
}