\hypertarget{WCT_8h}{
\section{WCT.h File Reference}
\label{WCT_8h}\index{WCT.h@{WCT.h}}
}
Wall Clock Time, function prototypes and public data structures.  


{\tt \#include \char`\"{}PBI/Endianness.h\char`\"{}}\par


Include dependency graph for WCT.h:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=66pt]{WCT_8h__incl}
\end{center}
\end{figure}


This graph shows which files directly or indirectly include this file:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=186pt]{WCT_8h__dep__incl}
\end{center}
\end{figure}
\subsection*{Data Structures}
\begin{CompactItemize}
\item 
struct \hyperlink{struct__WCT__time__sat__s}{\_\-WCT\_\-time\_\-sat\_\-s}
\begin{CompactList}\small\item\em This defines Spectrum Astro Standard Time (SAT) as a structure. \item\end{CompactList}\item 
union \hyperlink{union__WCT__time__sat__u}{\_\-WCT\_\-time\_\-sat\_\-u}
\begin{CompactList}\small\item\em This defines Spectrum Astro Standard Time (SAT) as a union between the structure and the long long representation. \item\end{CompactList}\end{CompactItemize}
\subsection*{Defines}
\begin{CompactItemize}
\item 
\hypertarget{WCT_8h_a0}{
\#define \hyperlink{WCT_8h_a0}{WCT\_\-K\_\-NSECS\_\-IN\_\-A\_\-SEC}\ 1000000000}
\label{WCT_8h_a0}

\begin{CompactList}\small\item\em Convenience symbol for 1,000,000,000. \item\end{CompactList}\item 
\hypertarget{WCT_8h_a1}{
\#define \hyperlink{WCT_8h_a1}{WCT\_\-K\_\-NSECS\_\-IN\_\-A\_\-MSEC}\ 1000000}
\label{WCT_8h_a1}

\begin{CompactList}\small\item\em Convenience symbol for 1,000,000, could come in handy; besides it completes the suite. \item\end{CompactList}\item 
\hypertarget{WCT_8h_a2}{
\#define \hyperlink{WCT_8h_a2}{WCT\_\-K\_\-NSECS\_\-IN\_\-A\_\-USEC}\ 1000}
\label{WCT_8h_a2}

\begin{CompactList}\small\item\em Convenience symbol for 1000, used when converting time specified in seconds.usecs to nanoseconds. \item\end{CompactList}\item 
\#define \hyperlink{WCT_8h_a3}{WCT\_\-EXTRACT\_\-SECS\_\-NSECS}(\_\-wct, \_\-secs, \_\-nsecs)
\begin{CompactList}\small\item\em Extracts the number of seconds/nanoseconds. \item\end{CompactList}\item 
\#define \hyperlink{WCT_8h_a4}{WCT\_\-SECS}(\_\-wct)\ (         (\_\-wct) / WCT\_\-K\_\-NSECS\_\-IN\_\-A\_\-SEC)
\begin{CompactList}\small\item\em Returns the number of full seconds in the specified time. \item\end{CompactList}\item 
\#define \hyperlink{WCT_8h_a5}{WCT\_\-NSECS}(\_\-wct)\ (         (\_\-wct) \% WCT\_\-K\_\-NSECS\_\-IN\_\-A\_\-SEC)
\begin{CompactList}\small\item\em Returns the fractional number of nanoseconds in the specified time. \item\end{CompactList}\item 
\#define \hyperlink{WCT_8h_a6}{WCT\_\-USECS}(\_\-wct)\ (WCT\_\-NSECS(\_\-wct) / WCT\_\-K\_\-NSECS\_\-IN\_\-A\_\-USEC)
\begin{CompactList}\small\item\em Returns the fractional number of microseconds in the specified time. \item\end{CompactList}\item 
\#define \hyperlink{WCT_8h_a7}{WCT\_\-MSECS}(\_\-wct)\ (WCT\_\-NSECS(\_\-wct) / WCT\_\-K\_\-NSECS\_\-IN\_\-A\_\-MSEC)
\begin{CompactList}\small\item\em Returns the fractional number of milliseconds in the specified time. \item\end{CompactList}\item 
\hypertarget{WCT_8h_a8}{
\#define \hyperlink{WCT_8h_a8}{WCT\_\-K\_\-UTB\_\-OFFSET\_\-IN\_\-SECS}\ 0x3a4fc880}
\label{WCT_8h_a8}

\begin{CompactList}\small\item\em The difference, in seconds, of the LAT epoch (Jan 1, 2001) and the traditional UNIX epoch (Jan 1, 1970). \item\end{CompactList}\item 
\#define \hyperlink{WCT_8h_a9}{WCT\_\-K\_\-UTB\_\-OFFSET\_\-IN\_\-NSECS}
\begin{CompactList}\small\item\em The difference, in nanoseconds, of the LAT epoch (Jan 1, 2001) and the traditional UNIX epoch (Jan 1, 1970). \item\end{CompactList}\end{CompactItemize}
\subsection*{Typedefs}
\begin{CompactItemize}
\item 
typedef int \hyperlink{WCT_8h_a10}{WCT\_\-tick}
\begin{CompactList}\small\item\em Typedef for differential time in Wall Clock Time units. \item\end{CompactList}\item 
typedef signed long long \hyperlink{WCT_8h_a11}{WCT\_\-time}
\begin{CompactList}\small\item\em Representation for an absolute Wall Clock Time time. \item\end{CompactList}\item 
\hypertarget{WCT_8h_a12}{
typedef signed long long int \hyperlink{WCT_8h_a12}{WCT\_\-time\_\-sat}}
\label{WCT_8h_a12}

\begin{CompactList}\small\item\em The Spectrum-Astro time as a long long int. \item\end{CompactList}\item 
\hypertarget{WCT_8h_a13}{
typedef \hyperlink{struct__WCT__time__sat__s}{\_\-WCT\_\-time\_\-sat\_\-s} \hyperlink{WCT_8h_a13}{WCT\_\-time\_\-sat\_\-s}}
\label{WCT_8h_a13}

\begin{CompactList}\small\item\em Typedef for struct {\em \hyperlink{struct__WCT__time__sat__s}{\_\-WCT\_\-time\_\-sat\_\-s}\/}. \item\end{CompactList}\item 
\hypertarget{WCT_8h_a14}{
typedef \hyperlink{union__WCT__time__sat__u}{\_\-WCT\_\-time\_\-sat\_\-u} \hyperlink{WCT_8h_a14}{WCT\_\-time\_\-sat\_\-u}}
\label{WCT_8h_a14}

\begin{CompactList}\small\item\em Typedef for struct {\em \hyperlink{union__WCT__time__sat__u}{\_\-WCT\_\-time\_\-sat\_\-u}\/}. \item\end{CompactList}\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
long long int \hyperlink{WCT_8h_a15}{WCT\_\-set} (register \hyperlink{WCT_8h_a11}{WCT\_\-time} atime, unsigned int ptime, unsigned int aticks, unsigned int pticks)
\begin{CompactList}\small\item\em Sets both the absolute time and the information needed to convert back and forth from {\em WCT\_\-atick\/} and {\em WCT\_\-ptick\/}. \item\end{CompactList}\item 
\hyperlink{WCT_8h_a11}{WCT\_\-time} \hyperlink{WCT_8h_a16}{WCT\_\-get} (void)
\begin{CompactList}\small\item\em Retrieves the current time in absolute time units. \item\end{CompactList}\item 
unsigned int \hyperlink{WCT_8h_a17}{WCT\_\-update} (void)
\begin{CompactList}\small\item\em Reset the time bases that tie the PTIME and ATIME. \item\end{CompactList}\item 
\hyperlink{WCT_8h_a11}{WCT\_\-time} \hyperlink{WCT_8h_a18}{WCT\_\-utb\_\-get} (void)
\begin{CompactList}\small\item\em Retrieves the current time in absolute time units. \item\end{CompactList}\item 
\hyperlink{WCT_8h_a11}{WCT\_\-time} \hyperlink{WCT_8h_a19}{WCT\_\-to\_\-utb} (\hyperlink{WCT_8h_a11}{WCT\_\-time} lat\_\-epoch\_\-time)
\begin{CompactList}\small\item\em Converts a wall clock time specified with a base of the LAT epoch to a wall clock time specified with a base of the tradional UNIX epoch. \item\end{CompactList}\item 
\hyperlink{WCT_8h_a11}{WCT\_\-time} \hyperlink{WCT_8h_a20}{WCT\_\-from\_\-utb} (\hyperlink{WCT_8h_a11}{WCT\_\-time} unix\_\-epoch\_\-time)
\begin{CompactList}\small\item\em Converts a wall clock time specified with a base of the LAT epoch to a wall clock time specified with a base of the tradional UNIX epoch. \item\end{CompactList}\item 
\hypertarget{WCT_8h_a21}{
\hyperlink{WCT_8h_a12}{WCT\_\-time\_\-sat} \hyperlink{WCT_8h_a21}{WCT\_\-sat\_\-get} (void)}
\label{WCT_8h_a21}

\begin{CompactList}\small\item\em Retrieves the current time in absolute time units. The format is in Spectrum-Astro Standard Time format. \item\end{CompactList}\item 
\hyperlink{WCT_8h_a12}{WCT\_\-time\_\-sat} \hyperlink{WCT_8h_a22}{WCT\_\-to\_\-sat} (\hyperlink{WCT_8h_a11}{WCT\_\-time} lat\_\-epoch\_\-time)
\begin{CompactList}\small\item\em Converts a wall clock time specified with Spectrum-Astro Standard Format. \item\end{CompactList}\item 
\hyperlink{WCT_8h_a11}{WCT\_\-time} \hyperlink{WCT_8h_a23}{WCT\_\-from\_\-sat} (\hyperlink{WCT_8h_a12}{WCT\_\-time\_\-sat} sat\_\-time)
\begin{CompactList}\small\item\em Converts a Spectrum Astro Time Format to LAT format. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
Wall Clock Time, function prototypes and public data structures. 

\begin{Desc}
\item[Author:]JJRussell - \href{mailto:russell@slac.stanford.edu}{\tt russell@slac.stanford.edu}\end{Desc}


\footnotesize\begin{verbatim}

    CVS $Id: WCT.h,v 1.6 2005/05/04 20:53:04 russell Exp $
\end{verbatim}\normalsize


\subsection{Define Documentation}
\hypertarget{WCT_8h_a3}{
\index{WCT.h@{WCT.h}!WCT_EXTRACT_SECS_NSECS@{WCT\_\-EXTRACT\_\-SECS\_\-NSECS}}
\index{WCT_EXTRACT_SECS_NSECS@{WCT\_\-EXTRACT\_\-SECS\_\-NSECS}!WCT.h@{WCT.h}}
\subsubsection[WCT\_\-EXTRACT\_\-SECS\_\-NSECS]{\setlength{\rightskip}{0pt plus 5cm}\#define WCT\_\-EXTRACT\_\-SECS\_\-NSECS(\_\-wct, \_\-secs, \_\-nsecs)}}
\label{WCT_8h_a3}


{\bf Value:}

\footnotesize\begin{verbatim}{                                                    \
   _secs  = (_wct) / WCT_K_NSECS_IN_A_SEC;           \
   _nsecs = (_wct) - WCT_K_NSECS_IN_A_SEC * (_secs); \
}
\end{verbatim}\normalsize 
Extracts the number of seconds/nanoseconds. 

(\_\-wct, \_\-secs, \_\-nsecs) 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-wct}]The WCT\_\-time to break down \item[{\em \_\-secs}]The number of full seconds in the specified time \item[{\em \_\-nsecs}]The number of nanoseconds remaining after the full seconds\end{description}
\end{Desc}
\begin{Desc}
\item[]The implementation of this macro is platform dependent. \end{Desc}
\hypertarget{WCT_8h_a9}{
\index{WCT.h@{WCT.h}!WCT_K_UTB_OFFSET_IN_NSECS@{WCT\_\-K\_\-UTB\_\-OFFSET\_\-IN\_\-NSECS}}
\index{WCT_K_UTB_OFFSET_IN_NSECS@{WCT\_\-K\_\-UTB\_\-OFFSET\_\-IN\_\-NSECS}!WCT.h@{WCT.h}}
\subsubsection[WCT\_\-K\_\-UTB\_\-OFFSET\_\-IN\_\-NSECS]{\setlength{\rightskip}{0pt plus 5cm}\#define WCT\_\-K\_\-UTB\_\-OFFSET\_\-IN\_\-NSECS}}
\label{WCT_8h_a9}


{\bf Value:}

\footnotesize\begin{verbatim}((unsigned long long)(WCT_K_UTB_OFFSET_IN_SECS) *                 \
         (unsigned long long)(WCT_K_NSECS_IN_A_SEC))
\end{verbatim}\normalsize 
The difference, in nanoseconds, of the LAT epoch (Jan 1, 2001) and the traditional UNIX epoch (Jan 1, 1970). 

\hypertarget{WCT_8h_a7}{
\index{WCT.h@{WCT.h}!WCT_MSECS@{WCT\_\-MSECS}}
\index{WCT_MSECS@{WCT\_\-MSECS}!WCT.h@{WCT.h}}
\subsubsection[WCT\_\-MSECS]{\setlength{\rightskip}{0pt plus 5cm}\#define WCT\_\-MSECS(\_\-wct)\ (WCT\_\-NSECS(\_\-wct) / WCT\_\-K\_\-NSECS\_\-IN\_\-A\_\-MSEC)}}
\label{WCT_8h_a7}


Returns the fractional number of milliseconds in the specified time. 

\begin{Desc}
\item[Returns:]the number of milliseconds in the specified time \end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-wct}]The time \end{description}
\end{Desc}
\hypertarget{WCT_8h_a5}{
\index{WCT.h@{WCT.h}!WCT_NSECS@{WCT\_\-NSECS}}
\index{WCT_NSECS@{WCT\_\-NSECS}!WCT.h@{WCT.h}}
\subsubsection[WCT\_\-NSECS]{\setlength{\rightskip}{0pt plus 5cm}\#define WCT\_\-NSECS(\_\-wct)\ (         (\_\-wct) \% WCT\_\-K\_\-NSECS\_\-IN\_\-A\_\-SEC)}}
\label{WCT_8h_a5}


Returns the fractional number of nanoseconds in the specified time. 

\begin{Desc}
\item[Returns:]the number of nanoseconds in the specified time \end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-wct}]The time \end{description}
\end{Desc}
\hypertarget{WCT_8h_a4}{
\index{WCT.h@{WCT.h}!WCT_SECS@{WCT\_\-SECS}}
\index{WCT_SECS@{WCT\_\-SECS}!WCT.h@{WCT.h}}
\subsubsection[WCT\_\-SECS]{\setlength{\rightskip}{0pt plus 5cm}\#define WCT\_\-SECS(\_\-wct)\ (         (\_\-wct) / WCT\_\-K\_\-NSECS\_\-IN\_\-A\_\-SEC)}}
\label{WCT_8h_a4}


Returns the number of full seconds in the specified time. 

\begin{Desc}
\item[Returns:]The number of full seconds in the specified time \end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-wct}]The time \end{description}
\end{Desc}
\hypertarget{WCT_8h_a6}{
\index{WCT.h@{WCT.h}!WCT_USECS@{WCT\_\-USECS}}
\index{WCT_USECS@{WCT\_\-USECS}!WCT.h@{WCT.h}}
\subsubsection[WCT\_\-USECS]{\setlength{\rightskip}{0pt plus 5cm}\#define WCT\_\-USECS(\_\-wct)\ (WCT\_\-NSECS(\_\-wct) / WCT\_\-K\_\-NSECS\_\-IN\_\-A\_\-USEC)}}
\label{WCT_8h_a6}


Returns the fractional number of microseconds in the specified time. 

\begin{Desc}
\item[Returns:]the number of microseconds in the specified time \end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-wct}]The time \end{description}
\end{Desc}


\subsection{Typedef Documentation}
\hypertarget{WCT_8h_a10}{
\index{WCT.h@{WCT.h}!WCT_tick@{WCT\_\-tick}}
\index{WCT_tick@{WCT\_\-tick}!WCT.h@{WCT.h}}
\subsubsection[WCT\_\-tick]{\setlength{\rightskip}{0pt plus 5cm}\hyperlink{WCT_8h_a10}{WCT\_\-tick}}}
\label{WCT_8h_a10}


Typedef for differential time in Wall Clock Time units. 

Absolute units are typically nanoseconds, but the WCT facility does not impose this. The representation is 32 bits, so with nanoseconds one can specify a delta time of +/- 2$\ast$31 nanoseconds or approximately +/- 2 seconds. \hypertarget{WCT_8h_a11}{
\index{WCT.h@{WCT.h}!WCT_time@{WCT\_\-time}}
\index{WCT_time@{WCT\_\-time}!WCT.h@{WCT.h}}
\subsubsection[WCT\_\-time]{\setlength{\rightskip}{0pt plus 5cm}\hyperlink{WCT_8h_a11}{WCT\_\-time}}}
\label{WCT_8h_a11}


Representation for an absolute Wall Clock Time time. 

\begin{Desc}
\item[Resolution]This is a 64 bit representation of absolute time. WCT originally did not say anything about the resolution, but slowly and surely a resolution of nanoseconds has crept in as a defacto standard. This gives WCT\_\-time a range of +/- 68 years.\end{Desc}
\begin{Desc}
\item[Base]Internally the base value, i.e. 0, represents Jan 1, 2001. Note that this is matches the S/C definition of the epoch, but not the usual UNIX definition of Jan 1, 1970. Since {\em WCT\_\-time\/} is a signed quantity, negative times represent dates before the epoch. It is not expected that these will be used, but for completeness it is described here.\end{Desc}
\begin{Desc}
\item[Common Utilities]Routines exist to fetch the current time in terms of traditional the UNIX epoch, {\em WCT\_\-utb\_\-get\/} (), for Unix Time Base Get, and to convert to and from UTB {\em WCT\_\-to\_\-utb\/} () and {\em \hyperlink{WCT_8h_a20}{WCT\_\-from\_\-utb()}\/}. \end{Desc}


\subsection{Function Documentation}
\hypertarget{WCT_8h_a23}{
\index{WCT.h@{WCT.h}!WCT_from_sat@{WCT\_\-from\_\-sat}}
\index{WCT_from_sat@{WCT\_\-from\_\-sat}!WCT.h@{WCT.h}}
\subsubsection[WCT\_\-from\_\-sat]{\setlength{\rightskip}{0pt plus 5cm}\hyperlink{WCT_8h_a11}{WCT\_\-time} WCT\_\-from\_\-sat (\hyperlink{WCT_8h_a12}{WCT\_\-time\_\-sat} {\em sat\_\-time})}}
\label{WCT_8h_a23}


Converts a Spectrum Astro Time Format to LAT format. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em sat\_\-time}]The wall clock time in Spectrum-Astro Format \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The wall clock time in LAT format \end{Desc}
\hypertarget{WCT_8h_a20}{
\index{WCT.h@{WCT.h}!WCT_from_utb@{WCT\_\-from\_\-utb}}
\index{WCT_from_utb@{WCT\_\-from\_\-utb}!WCT.h@{WCT.h}}
\subsubsection[WCT\_\-from\_\-utb]{\setlength{\rightskip}{0pt plus 5cm}\hyperlink{WCT_8h_a11}{WCT\_\-time} WCT\_\-from\_\-utb (\hyperlink{WCT_8h_a11}{WCT\_\-time} {\em unix\_\-epoch\_\-time})}}
\label{WCT_8h_a20}


Converts a wall clock time specified with a base of the LAT epoch to a wall clock time specified with a base of the tradional UNIX epoch. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em unix\_\-epoch\_\-time}]The wall clock time using the LAT epoch as a base \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The wall clock time using the UNIX epoch as a base \end{Desc}
\hypertarget{WCT_8h_a16}{
\index{WCT.h@{WCT.h}!WCT_get@{WCT\_\-get}}
\index{WCT_get@{WCT\_\-get}!WCT.h@{WCT.h}}
\subsubsection[WCT\_\-get]{\setlength{\rightskip}{0pt plus 5cm}\hyperlink{WCT_8h_a11}{WCT\_\-time} WCT\_\-get (void)}}
\label{WCT_8h_a16}


Retrieves the current time in absolute time units. 

This routine is coded to be a cheap call on the Power\-PC, involving less than 20 cycles. Other implementations may be more expensive. \hypertarget{WCT_8h_a15}{
\index{WCT.h@{WCT.h}!WCT_set@{WCT\_\-set}}
\index{WCT_set@{WCT\_\-set}!WCT.h@{WCT.h}}
\subsubsection[WCT\_\-set]{\setlength{\rightskip}{0pt plus 5cm}long long int WCT\_\-set (register \hyperlink{WCT_8h_a11}{WCT\_\-time} {\em atime}, unsigned int {\em ptime}, unsigned int {\em aticks}, unsigned int {\em pticks})}}
\label{WCT_8h_a15}


Sets both the absolute time and the information needed to convert back and forth from {\em WCT\_\-atick\/} and {\em WCT\_\-ptick\/}. 

\begin{Desc}
\item[Returns:]The adjustment time in absolute ticks.\end{Desc}
\begin{Desc}
\item[]This is a call-back routine to announce a precise time and the provide the numbers needed to convert absolute ticks to and from processor ticks. It is expected that this routine will be called from an ISR routine and, so is coded to obey the rules of an ISR.\end{Desc}
\begin{Desc}
\item[]The natural example is in the context of the 1 PPS interrupt. When the 1 PPS interrupt is received, the processor clock is read and the absolute time is retrieved from the most recent GPS message. The elapsed time in both absolute ticks and processor ticks since the last 1PPS message are the last two arguments.\end{Desc}
\begin{Desc}
\item[]Note that this routine does not assume that it being called at 1 second intervals or even regular intervals. The interface does not prohibit the caller from violating the three rules of a good clock. It is the responsibility of the caller to be a good citizen. Arthimetic limitations make it unsafe to call it at intervals longer than this.\end{Desc}
\begin{Desc}
\item[]If the time shift is very large, as in the case when the system has been running a while before the absolute time can be established, one may wish to use the return value to adjust times in other components of the system. The most notable example would be to adjust the expiration time in the WUT timer que entries. \end{Desc}
\hypertarget{WCT_8h_a22}{
\index{WCT.h@{WCT.h}!WCT_to_sat@{WCT\_\-to\_\-sat}}
\index{WCT_to_sat@{WCT\_\-to\_\-sat}!WCT.h@{WCT.h}}
\subsubsection[WCT\_\-to\_\-sat]{\setlength{\rightskip}{0pt plus 5cm}\hyperlink{WCT_8h_a12}{WCT\_\-time\_\-sat} WCT\_\-to\_\-sat (\hyperlink{WCT_8h_a11}{WCT\_\-time} {\em lat\_\-epoch\_\-time})}}
\label{WCT_8h_a22}


Converts a wall clock time specified with Spectrum-Astro Standard Format. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em lat\_\-epoch\_\-time}]The wall clock time using the LAT epoch as a base \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The wall clock time using in Spectrum-Astro Standard Format. \end{Desc}
\hypertarget{WCT_8h_a19}{
\index{WCT.h@{WCT.h}!WCT_to_utb@{WCT\_\-to\_\-utb}}
\index{WCT_to_utb@{WCT\_\-to\_\-utb}!WCT.h@{WCT.h}}
\subsubsection[WCT\_\-to\_\-utb]{\setlength{\rightskip}{0pt plus 5cm}\hyperlink{WCT_8h_a11}{WCT\_\-time} WCT\_\-to\_\-utb (\hyperlink{WCT_8h_a11}{WCT\_\-time} {\em lat\_\-epoch\_\-time})}}
\label{WCT_8h_a19}


Converts a wall clock time specified with a base of the LAT epoch to a wall clock time specified with a base of the tradional UNIX epoch. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em lat\_\-epoch\_\-time}]The wall clock time using the LAT epoch as a base \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The wall clock time using the UNIX epoch as a base \end{Desc}
\hypertarget{WCT_8h_a17}{
\index{WCT.h@{WCT.h}!WCT_update@{WCT\_\-update}}
\index{WCT_update@{WCT\_\-update}!WCT.h@{WCT.h}}
\subsubsection[WCT\_\-update]{\setlength{\rightskip}{0pt plus 5cm}unsigned WCT\_\-update (void)}}
\label{WCT_8h_a17}


Reset the time bases that tie the PTIME and ATIME. 

\begin{Desc}
\item[]This is a simplified version of WCT\_\-set. However, whereas WCT\_\-set adjusts both the time base and the frequency, this routine only adjusts the only time bases to the current time without changing the frequency. It is primarily meant to be used in an environment where there is no external clock/time source and is needed to keep the time conversion scaling parameters from causing an overflow.\end{Desc}
\begin{Desc}
\item[Warning:]Since this routine resets the scaling parameters, it must be called under conditions which ensure that the scaling parameters are not being modified by another thread of execution. Typically the easiest way to ensure this condition is to lock the interrupts around the call to WCT\_\-update. A design choice was made to not have this routine do the locking for two reasons\begin{enumerate}
\item The user may have a better way to ensure this\item The most natural calling of this routine will occur within the context of a WUT ISR, i.e. interrrupts are already locked. \end{enumerate}
\end{Desc}
\hypertarget{WCT_8h_a18}{
\index{WCT.h@{WCT.h}!WCT_utb_get@{WCT\_\-utb\_\-get}}
\index{WCT_utb_get@{WCT\_\-utb\_\-get}!WCT.h@{WCT.h}}
\subsubsection[WCT\_\-utb\_\-get]{\setlength{\rightskip}{0pt plus 5cm}\hyperlink{WCT_8h_a11}{WCT\_\-time} WCT\_\-utb\_\-get (void)}}
\label{WCT_8h_a18}


Retrieves the current time in absolute time units. 

This routine is coded to be a cheap call on the Power\-PC, involving less than 20 cycles. Other implementations may be more expensive. 