PosixClock.cc

Go to the documentation of this file.
00001 #include "PosixClock.hh"
00002 
00003 #include <stdlib.h>
00004 
00005 namespace certi {
00006 
00007 PosixClock::PosixClock(clockid_t newClockId) : Clock("PosixClock")
00008 {
00009     clockId = newClockId;
00010     clock_getres(newClockId, &resolution);
00011 }   
00012 
00013 double 
00014 PosixClock::getResolution() {
00015     return resolution.tv_sec*1e9 + resolution.tv_nsec;
00016 }
00017 
00018 uint64_t PosixClock::getCurrentTicksValue() {
00019     struct timespec  current;
00020     /* convert struct timespec to number of nano-second */ 
00021     clock_gettime(clockId, &current);
00022     return current.tv_sec*1000000000 + current.tv_nsec;
00023 }
00024 
00025 double   
00026 PosixClock::tick2NanoSecond(const uint64_t ticks) {
00027      return ticks;
00028 }
00029 
00030 PosixClock::~PosixClock()
00031 {
00032 }
00033 
00034 }

Generated on Thu Apr 30 15:53:49 2009 for CERTIDeveloperDocumentation by doxygen 1.5.5