Main Page | Class Hierarchy | Class List | Directories | File List | Class Members

mnt_media_time_stamper.h

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; /* x 9 */
00035                         /* sec * 90Khz + (usec * 90Khz) / 1e6 */
00036                         u = tv.tv_sec * 90000 + (u / 100);
00037                         return (u + offset_);
00038                 }
00039 };
00040 
00041 #endif

Generated on Thu Aug 25 14:07:38 2005 for mnt by  doxygen 1.4.4