GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> PBS / V2-12-1 > pbs / rhel6-32


Interface   Data Structures   File List   Data Fields   Globals  

WCT.c.ux-xxx-xxx File Reference

Implementation file for the WCT (Wall Clock Time) facility for UNIX platforms. More...

#include <PBI/Alias.h>

Functions

long long int WCT_set (register WCT_time atime, unsigned int ptime, unsigned int aticks, unsigned int pticks)
 Sets both the absolute time and the information needed to convert back and forth from WCT_atick and WCT_ptick.
unsigned int WCT_update (void)
 Reset the time bases that tie the PTIME and ATIME.


Detailed Description

Implementation file for the WCT (Wall Clock Time) facility for UNIX platforms.


    CVS $Id: WCT.c.ux-xxx-xxx,v 1.6 2011/03/24 23:05:47 apw Exp $

Function Documentation

long long int WCT_set ( register WCT_time  atime,
unsigned int  ptime,
unsigned int  aticks,
unsigned int  pticks 
)

Sets both the absolute time and the information needed to convert back and forth from WCT_atick and WCT_ptick.

Returns:
The adjustment time in absolute ticks.
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.
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.
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.
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.

Referenced by PBS_initialize2().

unsigned int WCT_update ( void   ) 

Reset the time bases that tie the PTIME and ATIME.

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.
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
  1. The user may have a better way to ensure this
  2. The most natural calling of this routine will occur within the context of a WUT ISR, i.e. interrrupts are already locked.


Generated on Mon Aug 1 14:54:45 2011 by  doxygen 1.5.8