00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef __ZTicks__
00026 #define __ZTicks__ 1
00027 #include "zconfig.h"
00028
00029 #include "ZTypes.h"
00030
00031 #if ZCONFIG(OS, MacOS7) || ZCONFIG(OS, Carbon) || ZCONFIG(OS, MacOSX)
00032 # if ZCONFIG(OS, MacOSX)
00033 # include <HIToolbox/Events.h>
00034 # else
00035 # include <Events.h>
00036 # endif
00037 #endif
00038
00039 #if ZCONFIG(OS, POSIX)
00040 # include <sys/time.h>
00041 #endif
00042
00043 #if ZCONFIG(OS, Be)
00044 # include <interface/InterfaceDefs.h>
00045 # include <kernel/OS.h>
00046 #endif
00047
00048
00049
00050 namespace ZTicks {
00051
00052 #if ZCONFIG(OS, MacOS7) || ZCONFIG(OS, Carbon) || ZCONFIG(OS, MacOSX) || ZCONFIG(OS, Win32)
00053 bigtime_t sNow();
00054
00055 #elif ZCONFIG(OS, POSIX)
00056 inline bigtime_t sNow()
00057 {
00058 timeval theTimeVal;
00059 ::gettimeofday(&theTimeVal, nil);
00060 return (bigtime_t(theTimeVal.tv_sec) * 1000000LL) + bigtime_t(theTimeVal.tv_usec);
00061 }
00062
00063 #elif ZCONFIG(OS, Be)
00064 inline bigtime_t sNow()
00065 { return ::system_time(); }
00066
00067 #endif // ZCONFIG_OS
00068
00069
00070 inline bigtime_t sPerSecond()
00071 { return 1000000; }
00072
00073
00074 #if ZCONFIG(OS, MacOS7) || ZCONFIG(OS, Carbon) || ZCONFIG(OS, MacOSX)
00075 inline bigtime_t sDoubleClick()
00076 { return bigtime_t(::GetDblTime()) * 16667LL; }
00077
00078 #elif ZCONFIG(OS, Win32)
00079 bigtime_t sDoubleClick();
00080
00081 #elif ZCONFIG(OS, POSIX)
00082 inline bigtime_t sDoubleClick()
00083 { return sPerSecond() / 10; }
00084
00085 #elif ZCONFIG(OS, Be)
00086 inline bigtime_t sDoubleClick()
00087 {
00088 bigtime_t result;
00089 ::get_click_speed(&result);
00090 return result;
00091 }
00092 #endif
00093
00094 #if ZCONFIG(OS, MacOS7) || ZCONFIG(OS, Carbon) || ZCONFIG(OS, MacOSX)
00095 inline bigtime_t sCaretFlash()
00096 { return bigtime_t(::GetCaretTime()) * 16667LL; }
00097
00098 #else
00099 inline bigtime_t sCaretFlash()
00100 { return sPerSecond() / 5; }
00101
00102 #endif
00103
00104 }
00105
00106
00107
00108 #endif // __ZTicks__