00001 #ifndef MNT_MEDIA_TIME_STAMPER_H
00002 #define MNT_MEDIA_TIME_STAMPER_H
00003
00004 #include <stdlib.h>
00005 #include <sys/time.h>
00006
00011 class MntMediaTimeStamper {
00012
00013 uint32_t offset_;
00015 public:
00016
00020 MntMediaTimeStamper()
00021 {
00022 offset_ = random();
00023 }
00024
00029 uint32_t get_curr_timestamp()
00030 {
00031 timeval tv;
00032 ::gettimeofday(&tv, 0);
00033 uint32_t u = tv.tv_usec;
00034 u = (u << 3) + u;
00035
00036 u = tv.tv_sec * 90000 + (u / 100);
00037 return (u + offset_);
00038 }
00039 };
00040
00041 #endif