This file is indexed.

/usr/include/simavr/sim_time.h is in libsimavr-dev 1.5+dfsg1-2.

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
/*
	sim_time.h

	Copyright 2008-2012 Michel Pollet <buserror@gmail.com>

 	This file is part of simavr.

	simavr 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 3 of the License, or
	(at your option) any later version.

	simavr 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.

	You should have received a copy of the GNU General Public License
	along with simavr.  If not, see <http://www.gnu.org/licenses/>.
 */


#ifndef __SIM_TIME_H___
#define __SIM_TIME_H___

#ifdef __cplusplus
extern "C" {
#endif

#include "sim_avr.h"

// converts a number of usec to a number of machine cycles, at current speed
static inline avr_cycle_count_t
avr_usec_to_cycles(struct avr_t * avr, uint32_t usec)
{
	return avr->frequency * (avr_cycle_count_t)usec / 1000000;
}

// converts back a number of cycles to usecs (for usleep)
static inline uint32_t
avr_cycles_to_usec(struct avr_t * avr, avr_cycle_count_t cycles)
{
	return 1000000L * cycles / avr->frequency;
}

// converts back a number of cycles to nsecs
static inline uint64_t
avr_cycles_to_nsec(struct avr_t * avr, avr_cycle_count_t cycles)
{
	return (uint64_t)1E6 * (uint64_t)cycles / (avr->frequency/1000);
}

// converts a number of hz (to megahertz etc) to a number of cycle
static inline avr_cycle_count_t
avr_hz_to_cycles(avr_t * avr, uint32_t hz)
{
	return avr->frequency / hz;
}

#ifdef __cplusplus
};
#endif

#endif /* __SIM_TIME_H___ */