#include #include // make with the following commands: // // gcc prog.c -fPIC -g -fno-omit-frame-pointer -I. -rdynamic -o prog -lpthread -ldl -lm #define NULL ((void *) 0) #define UNIX_REFERENCE_INTERVAL -978307200.0 // from NSDate.h #define _FLP_ __FILE__, __LINE__, __PRETTY_FUNCTION__ void xx_gettimeofday (struct timeval *tp, void *v) { tp->tv_sec = 988941076; tp->tv_usec = 43238; } double GSTimeNow() { double interval; struct timeval tp; xx_gettimeofday (&tp, NULL); interval = UNIX_REFERENCE_INTERVAL; printf( "%s:%d %s %13.0f ( %08X %08X )\n", _FLP_, interval, interval ); printf( "%s:%d %s %13d ( %08X ) %10d ( %08X )\n", _FLP_, tp.tv_sec, tp.tv_sec, tp.tv_usec, tp.tv_usec ); interval += tp.tv_sec; printf( "%s:%d %s %16.2f ( %08X %08X )\n", _FLP_, interval, interval ); interval += (double)tp.tv_usec / 1000000.0; printf( "%s:%d %s %16.2f ( %08X %08X )\n", _FLP_, interval, interval ); return interval; } int main( int argc, char **argv) { GSTimeNow(); printf( "\n" ); GSTimeNow(); return 0; }