Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #ifndef CLOCK_H_
00009 #define CLOCK_H_
00010
00011 #include <sys/types.h>
00012 #include <sys/time.h>
00013
00014 #include "ibrdtn/data/Bundle.h"
00015
00016 namespace dtn
00017 {
00018 namespace utils
00019 {
00020 class Clock
00021 {
00022 public:
00023 static size_t getUnixTimestamp();
00024 static size_t getTime();
00025
00026 static bool isExpired(const dtn::data::Bundle &b);
00027
00032 static bool isExpired(size_t timestamp, size_t lifetime = 0) __attribute__ ((deprecated));
00033
00034 static size_t getExpireTime(const dtn::data::Bundle &b);
00035
00040 static size_t getExpireTime(size_t timestamp, size_t lifetime) __attribute__ ((deprecated));
00041
00048 static size_t getExpireTime(size_t lifetime);
00049
00053 static void settimeofday(struct timeval *tv);
00054
00060 static void gettimeofday(struct timeval *tv);
00061
00066 static void setOffset(struct timeval &tv);
00067
00068 static int timezone;
00069
00070 static u_int32_t TIMEVAL_CONVERSION;
00071
00077 static float quality;
00078
00083 static bool badclock;
00084
00089 static bool modify_clock;
00090
00091 private:
00092 Clock();
00093 virtual ~Clock();
00094
00095 static bool __isExpired(size_t timestamp, size_t lifetime = 0);
00096 static size_t __getExpireTime(size_t timestamp, size_t lifetime);
00097
00098 static struct timeval _offset;
00099 static bool _offset_init;
00100 };
00101 }
00102 }
00103
00104 #endif