fdhwlib  2.0.25
akTimeLib Class Reference

#include <aktimelib.h>

Inheritance diagram for akTimeLib:
akSingleton

List of all members.

Public Member Functions

Static Public Member Functions

Protected Member Functions

Private Attributes

Static Private Attributes

Friends


Detailed Description

Library to handle the different time formats.

The class needs to reads it's basic information (about the leap seconds) from some configuration file. Before using the library the first time load these value with the function init.

The first implementation is based on a default number of leap second at the presend time and the time when the next leap second will occure. After this given occurence the ini file parameters have to be adjusted.

There are two values taken from the ini file (stanard FE.ini):

  • The actual number of leap seconds (default is 13) and
  • the time (in UTC format) when the next leap second is introcuded. If this value is zero no change in the leap second is considered.

A sample entry is FE.ini looks like:

 [GPSTime]
 ; number of leap seconds (before nextLeapSecond - time)
 leapSeconds = 13
 ; Time when the next leap second occures (UTC seconds)
 nextLeapSecond = 1016534603
 

Definition at line 156 of file aktimelib.h.


Constructor & Destructor Documentation

akTimeLib::akTimeLib ( ) [protected]
akTimeLib::~akTimeLib ( ) [inline]

Definition at line 167 of file aktimelib.h.

References cleaner, and akSingletonCleaner::setObject().

              {
   cleaner.setObject( 0 );
     //instance = (akTimeLib) 0;  // ???
  }

Member Function Documentation

int akTimeLib::addLeapSecond ( )

Add new leap second.

time_t akTimeLib::convertGPSToUTC ( unsigned long  t_gps)

Convert the Hardware second counter the the format used by the PC (UTC time started at 1.1.1970)

Parameters:
t_gpsSecond counter in GPS format
Returns:
Time in UTC format format
unsigned long akTimeLib::convertUTCToGPS ( time_t  t_utc)

Convert UTC to GPS time.

Parameters:
t_utcSecond counter in UTC format
Returns:
Time in GPS format format
void akTimeLib::dump ( FILE *  fout = stdout) [inline]

Give information about class internals.

Definition at line 184 of file aktimelib.h.

                              {
    
     fprintf(fout, "akTimeLib: \n");

     // TODO: Give information about the next
     // change in the number of leap seconds
     // --> Table of second counters...
     
  }
static akTimeLib* akTimeLib::getReference ( ) [static]

Get the reference to the singleton.

void akTimeLib::init ( const char *  inifile = "aktimelib.ini",
FILE *  fout = 0 
)

Read the leap seconds table from an ini file.

int akTimeLib::isLeapSecond ( unsigned long  t_gps)

Check if a gps second counter points to an leap second.

Returns:
-1 error, 0 no lepa second, 1 leap second
int akTimeLib::nLeapSeconds ( unsigned long  t_gps)

Determine the number of leap seconds.

void akTimeLib::test ( )

Test the functions of the class.


Friends And Related Function Documentation

friend class akSingletonCleaner [friend]

Definition at line 160 of file aktimelib.h.


Member Data Documentation

Can the cleaner be defined in the singleton class? I fear, it will only be possible to have one singleton in a program ?!

Definition at line 239 of file aktimelib.h.

Referenced by ~akTimeLib().

unsigned long akTimeLib::gpsDelay [private]

Delay between GPS and UTC second count gpsDelay = t(UTP) - t(GPS)

Definition at line 246 of file aktimelib.h.

akTimeLib akTimeLib::instance [static, private]

The only instance of this singleton class.

Definition at line 235 of file aktimelib.h.

unsigned long* akTimeLib::leapSecGps [private]

List of gps seconds where a leap second is added.

Definition at line 259 of file aktimelib.h.

int* akTimeLib::leapSecN [private]

Number of leap second beginning from leapSecGps.

Definition at line 265 of file aktimelib.h.

int akTimeLib::leapSeconds [private]

Number of actual leap seconds.

Definition at line 251 of file aktimelib.h.

unsigned long* akTimeLib::leapSecUtc [private]

List of utc/ntp second where a leap second is added.

Definition at line 262 of file aktimelib.h.

unsigned long akTimeLib::nextLeapSecond [private]

Time when the next leap second occures.

This time has to be given in UTC seconds.

Definition at line 256 of file aktimelib.h.

int akTimeLib::nLeapSecs [private]

Number of entries in the leap list.

Definition at line 268 of file aktimelib.h.

int akTimeLib::noLeapSecTable [static, private]

Flag to show if leap second table is missing.

Definition at line 271 of file aktimelib.h.


The documentation for this class was generated from the following file: