Sophie

Sophie

distrib > Mandriva > 8.2 > i586 > media > contrib > by-pkgid > 211238da6d926d1ca4390483bb29f586 > files > 50

coda-doc-5.2.0-4mdk.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
 <META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
 <TITLE> RPC2 User Guide and Reference Manual: The Fast Time Package </TITLE>
 <LINK HREF="rpc2_manual-14.html" REL=next>
 <LINK HREF="rpc2_manual-12.html" REL=previous>
 <LINK HREF="rpc2_manual.html#toc13" REL=contents>
</HEAD>
<BODY>
<A HREF="rpc2_manual-14.html">Next</A>
<A HREF="rpc2_manual-12.html">Previous</A>
<A HREF="rpc2_manual.html#toc13">Contents</A>
<HR>
<H2><A NAME="s13">13. The Fast Time Package </A></H2>

<P>The Fast Time package allows the caller to find out the current time of day
without incurring the expense of a kernel call.  It works by mapping the
page of the kernel that has the kernels time-of-day variable and
examining it directly.  Currently, this package only works on Suns.  You may
call the routines on other machines, but they will run more slowly.
<P>The initialization routine for this package is fairly expensive since it
does a lookup of a kernel symbol via nlist ().  If you have a program which
runs for only a short time, you may wish to call @FT(Init) with the
<CODE>notReally</CODE> parameter true to prevent the lookup from taking place.  This
is useful if you are using another package that uses Fast Time (such as
RPC2).
<P>
<P>
<H2><A NAME="ss13.1">13.1 Fast Time Primitives</A>
</H2>

<P>
<P>
<H3>FT_Init  -- Initialize the Fast Time package </H3>

<P>
<H3>Call:</H3>

<P><EM>int FT_Init(</EM><B>in</B> int printErrors&gt;, @w&lt;<B>in</B> int notReally  <EM>)</EM>
<H3>Parameters:</H3>

<P>
<DL>
<DT><B>printErrors</B><DD><P>Print error messages on stderr if somethingn goes wrong
<DT><B>notReally</B><DD><P>Dont really do the memory mapping.  Make <B>FT_GetTimeOfDay</B>
</DL>
<H3>Completion Codes:</H3>

<P>
<DL>
<DT><B>0</B><DD><P>No problems
<DT><B>-1</B><DD><P>Error in initialization
</DL>
<H3>Description:</H3>

<P>This call mmaps the kernel page with the time of day variable.
If the routine returns -1, calls to <B>FT_GetTimeOfDay</B>
will still work properly, but will make a kernel call.
)
<P>
<H3>FTGetTimeOfDay  -- Get the time of day from the mapped kernel pages </H3>

<P>
<H3>Call:</H3>

<P><EM>int FTGetTimeOfDay(</EM>  <EM>)</EM>
<H3>Parameters:</H3>

<P>
<DL>
<DT><B>tv</B><DD><P>Where to put the time of day
<DT><B>tz</B><DD><P>Where to put the time zone information
</DL>
<H3>Completion Codes:</H3>

<P>
<DL>
<DT><B>0</B><DD><P>No problem
<DT><B>-1</B><DD><P>Something went wrong
</DL>
<H3>Description:</H3>

<P>This function has the same calling sequence as the kernels
<B>gettimeofday</B> routine.  If the <B>tz</B> parameter is not zero,
or if initialization failed, or if the <B>notReally</B> parameter
in the initialization was true, then this routine calls
<B>gettimeofday</B>.  Otherwise, it looks in the mapped page of
the kernel to get the time of day.&gt;
<P>
<P>
<P>
<P>
<P>
<P>
<HR>
<A HREF="rpc2_manual-14.html">Next</A>
<A HREF="rpc2_manual-12.html">Previous</A>
<A HREF="rpc2_manual.html#toc13">Contents</A>
</BODY>
</HTML>