This file is indexed.

/usr/include/pike8.0/pike/time_stuff.h is in pike8.0-dev 8.0.164-1build1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
/*
|| 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.
*/

#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
#undef HAVE_TIME_H
#undef TIME_WITH_SYS_TIME

#define my_timercmp(tvp, cmp, uvp) \
  ( (tvp)->tv_sec == (uvp)->tv_sec ? \
    (tvp)->tv_usec cmp (uvp)->tv_usec : \
    (tvp)->tv_sec cmp (uvp)->tv_sec )

#define my_subtract_timeval(X, Y)		\
  do {						\
    struct timeval *_a=(X), *_b=(Y);		\
    _a->tv_sec -= _b->tv_sec;			\
    _a->tv_usec -= _b->tv_usec;			\
    if(_a->tv_usec < 0) {			\
      _a->tv_sec--;				\
      _a->tv_usec+=1000000;			\
    }						\
  } while(0)

#define my_add_timeval(X, Y)			\
  do {						\
    struct timeval *_a=(X), *_b=(Y);		\
    _a->tv_sec += _b->tv_sec;			\
    _a->tv_usec += _b->tv_usec;			\
    if(_a->tv_usec >= 1000000) {		\
      _a->tv_sec++;				\
      _a->tv_usec-=1000000;			\
    }						\
  } while(0)

/* Note: fdlib.c contains a function local_time_to_utc that converts a
 * time_t containing local time to a real one (i.e. UTC). It might be
 * generally useful but is so far slightly MS specific, which is why
 * it still resides in fdlib.c. (It just needs some more of the usual
 * HAVE_XYZ configure test hoopla.) */

#ifndef STRUCT_TIMEVAL_DECLARED
#define STRUCT_TIMEVAL_DECLARED
#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