This file is indexed.

/usr/include/ETL/_clock_base.h is in etl-dev 0.04.17-1.

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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/*! ========================================================================
** Extended Template and Library
** Clock Abstraction Implementation
** $Id$
**
** Copyright (c) 2002 Robert B. Quattlebaum Jr.
**
** This package is free software; you can redistribute it and/or
** modify it under the terms of the GNU General Public License as
** published by the Free Software Foundation; either version 2 of
** the License, or (at your option) any later version.
**
** This package is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
** General Public License for more details.
**
** === N O T E S ===========================================================
**
** This is an internal header file, included by other ETL headers.
** You should not attempt to use it directly.
**
** ========================================================================= */

/* === S T A R T =========================================================== */

#ifndef __ETL__CLOCK_H
#define __ETL__CLOCK_H

/* === H E A D E R S ======================================================= */

#ifndef WIN32
#include <unistd.h>
#else
inline void sleep(int i) { Sleep(i*1000); }
#endif

/* === M A C R O S ========================================================= */

/* === T Y P E D E F S ===================================================== */

/* === C L A S S E S & S T R U C T S ======================================= */

_ETL_BEGIN_NAMESPACE

inline void yield() { sleep(0); }

/*! ========================================================================
** \class	clock_base
** \brief	clock abstraction
**
** A more detailed description needs to be written.
*/
template <class DESC>
class clock_base : public DESC
{
public:
	typedef typename DESC::value_type value_type;

private:
	typedef clock_base<DESC> _clock;
	typedef typename DESC::timestamp timestamp;

	timestamp base_time;

	using DESC::get_current_time;
	using DESC::realtime;
	using DESC::one_second;
public:

	clock_base() { reset(); }

	void reset()
	{ get_current_time(base_time); }

	value_type operator()()const
	{ return this->timestamp_to_seconds(get_current_time()-base_time); }

	value_type pop_time()
	{
		// Grab the old base time
		timestamp old_time=base_time;

		// Put the current time into base_time
		get_current_time(base_time);

		return this->timestamp_to_seconds(base_time-old_time);
	}

	static void
	sleep(const value_type &length)
	{
		if(!realtime())
			::sleep((int)(length+0.5));
		else
		{
			_clock timer;
			timer.reset();
			value_type val;
			for(val=timer();one_second()<length-val;val=timer())
				::sleep((int)((length-val)/2.0+0.4));
			while(timer()<length)
			  ;
		}


		/* This is a different waiting mechanism that uses
		** the native timestamp type of the clock rather
		** than converting it to a double (or whatever).
		** You would think that this would be at least a
		** few microseconds faster, but a few tests on my
		** PowerBook G4 have proved otherwise. Indeed I loose
		** several microseconds using this "optimized" method.
		** Bizarre.
		**	- darco (8-17-2002)
		{
			timestamp endtime=get_current_time()+seconds_to_timestamp(length);
			timestamp loopendtime=get_current_time()+seconds_to_timestamp(length-1.0);
			while(get_current_time()<loopendtime)
				::sleep((int)timestamp_to_seconds(loopendtime-get_current_time())/2.0);
			while(get_current_time()<endtime);
		}
		*/

		return;
	}
};

_ETL_END_NAMESPACE

/* === E N D =============================================================== */

#endif