fdhwlib
2.0.25
|
00001 /*************************************************************************** 00002 aktimelib.h - description 00003 00004 begin : Thu Feb 21 2002 00005 copyright : (C) 2002 by A Kopmann 00006 email : kopmann@ipe.fzk.de 00007 status : 00008 test : 00009 history : 00010 ***************************************************************************/ 00011 00012 00013 #ifndef AKTIMELIB_H 00014 #define AKTIMELIB_H 00015 00016 #include <akutil/procDuration.h> 00017 #include <akutil/aksingleton.h> 00018 #include <akutil/aksingletoncleaner.h> 00019 00020 00156 class akTimeLib : public akSingleton 00157 { 00158 public: 00159 // akSingletonCleaner needs to delete this call at program end! 00160 friend class akSingletonCleaner; 00161 00162 00163 protected: 00164 akTimeLib(); 00165 00166 public: // Windows does not allow protected destructors?? 00167 ~akTimeLib(){ 00168 cleaner.setObject( 0 ); 00169 //instance = (akTimeLib) 0; // ??? 00170 } 00171 00172 00173 00174 public: 00175 00177 static akTimeLib *getReference(); 00178 00179 00181 void init(const char *inifile="aktimelib.ini", FILE *fout=0); 00182 00184 void dump(FILE *fout=stdout){ 00185 00186 fprintf(fout, "akTimeLib: \n"); 00187 00188 // TODO: Give information about the next 00189 // change in the number of leap seconds 00190 // --> Table of second counters... 00191 00192 } 00193 00195 void test(); 00196 00197 00205 time_t convertGPSToUTC(unsigned long t_gps); 00206 00207 00213 unsigned long convertUTCToGPS(time_t t_utc); 00214 00220 int isLeapSecond(unsigned long t_gps); 00221 00224 int nLeapSeconds(unsigned long t_gps); 00225 00230 int addLeapSecond(); 00231 00232 private: 00233 00235 static akTimeLib instance; 00236 00239 static akSingletonCleaner cleaner; 00240 00241 00242 00246 unsigned long gpsDelay; 00247 00251 int leapSeconds; 00252 00256 unsigned long nextLeapSecond; 00257 00259 unsigned long *leapSecGps; 00260 00262 unsigned long *leapSecUtc; 00263 00265 int *leapSecN; 00266 00268 int nLeapSecs; 00269 00271 static int noLeapSecTable; 00272 00273 }; 00274 00275 00276 00277 #endif