Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

MNRTPtime.h

Go to the documentation of this file.
00001 /* Copyright (C) 2000 KOM/Darmstadt University of Technology 00002 * 00003 * You are allowed to use all other parts of the code under the following terms: 00004 * 00005 * For non-commercial use, code may be used in unmodified form provided 00006 * that this copyright notice and this permission notice appear in 00007 * supporting documentation. 00008 * 00009 * This software is provided "as is" and without any express or implied 00010 * warranties, including, without limitation, the implied warranty of 00011 * fitness for a particular purpose. 00012 * 00013 * The code may be subjected to the GNU General Public License, Version 2, 00014 * and re-distributed under the terms of this license. 00015 * As a special exception, permission is granted to link this code 00016 * with the Qt library and distribute executables, as long as you 00017 * follow the requirements of the GNU GPL in regard to all of the 00018 * software in the executable aside from Qt. 00019 * 00020 * Commercial use other than under the terms of the GNU General Public 00021 * License is allowed only after express negotiation of conditions 00022 * with the authors. 00023 */ 00024 #ifndef MNRTP_TIME_H 00025 #define MNRTP_TIME_H 00026 00027 #include <assert.h> 00028 #include <sys/time.h> 00029 #include <stdio.h> 00030 00031 #include "var_type.h" 00032 00033 /* time functions */ 00034 00035 #define LOWER_MASK 65535 00036 #define DELTA_DIFF 65535 00037 /* offset between 1.jan 1900 and 1.jan 1970 */ 00038 #define GETTIMEOFDAY_TO_NTP_OFFSET 0x83AA7E80 00039 00040 struct ntp64 00041 { 00042 u_int32 upper; 00043 u_int32 lower; 00044 00045 ntp64() { 00046 upper = 0; 00047 lower = 0; 00048 } 00049 00050 inline ntp64& operator= ( const ntp64& orig ) { 00051 upper = orig.upper; 00052 lower = orig.lower; 00053 return *this; 00054 } 00055 }; 00056 00057 inline u_int32 get_upper_16bits(u_int32 x) 00058 { 00059 return ((x >> 16) & LOWER_MASK); 00060 } 00061 00062 inline u_int32 get_lower_16bits(u_int32 x) 00063 { 00064 return (x & LOWER_MASK); 00065 } 00066 00067 /* get the lower 16 of x and the upper 16 of y */ 00068 inline u_int32 get_middle_32bits(u_int32 x, u_int32 y) 00069 { 00070 return ((get_lower_16bits(x) << 16 ) | (get_upper_16bits(y))); 00071 } 00072 00076 extern ntp64 getntptime(); 00077 00094 extern u_int32 time2ts(const ntp64& time, const ntp64& time_first, u_int32 freq); 00095 00096 #endif 00097

Generated on Sun Mar 6 13:35:49 2005 for Komssys by doxygen 1.3.8