pike.git / src / time_stuff.h

version» Context lines:

pike.git/src/time_stuff.h:1:   /*   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id$ +    */      #ifndef TIME_STUFF_H   #define TIME_STUFF_H      #include "global.h"      #if TIME_WITH_SYS_TIME   # include <sys/time.h>   # include <time.h>   #else   # if HAVE_SYS_TIME_H   # include <sys/time.h>   # else - # if HAVE_TIME_H +    # include <time.h> - # endif +    # endif   #endif      #ifdef HAVE_WINSOCK2_H   # include <winsock2.h>   #elif defined(HAVE_WINSOCK_H)   # include <winsock.h>   #endif      #undef HAVE_SYS_TIME_H
pike.git/src/time_stuff.h:71:   #endif      #ifndef HAVE_STRUCT_TIMEVAL   struct timeval   {    long tv_sec;    long tv_usec;   };   #endif    + PMOD_EXPORT extern struct timeval current_time; + PMOD_EXPORT extern int current_time_invalid; +  + #define INVALIDATE_CURRENT_TIME() do { current_time_invalid = 1; } while (0) + #define UPDATE_CURRENT_TIME() do { \ +  GETTIMEOFDAY(&current_time); \ +  current_time_invalid = 0; \ +  } while (0) + #define ACCURATE_GETTIMEOFDAY(X) do { \ +  UPDATE_CURRENT_TIME(); \ +  *(X) = current_time; \ +  } while (0) + #define ACCURATE_GETTIMEOFDAY_RVAL(X, ___rval) do { \ +  (___rval) = GETTIMEOFDAY(&current_time); \ +  current_time_invalid = 0; \ +  *(X) = current_time; \ +  } while (0) + #define INACCURATE_GETTIMEOFDAY(X) do { \ +  /* unlikely() not available */ \ +  if (!(current_time_invalid)) { } \ +  else UPDATE_CURRENT_TIME(); \ +  *(X) = current_time; \ +  } while (0) +    #endif