This file is indexed.

/usr/include/zthread/Time.h is in libzthread-dev 2.3.2-8.

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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
/*
 * Copyright (c) 2005, Eric Crahen
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is furnished
 * to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 *
 */

#ifndef __ZTTIME_H__
#define __ZTTIME_H__

#include "zthread/Config.h"

namespace ZThread {

/**
 * @class Time
 * @author Eric Crahen <http://www.code-foo.com>
 * @date <2003-07-16T17:52:46-0400>
 * @version 2.2.11
 *
 * The Time class provides access to time values relative to when the program
 * was started. In other words, this class might be thought of as a timer that
 * starts at 0 and counts upwards. This class offers millisecond resolution.
 */
class ZTHREAD_API Time {

  unsigned long _seconds;
  unsigned long _milliseconds;

  //! Create a new Time object
  Time(unsigned long secs, unsigned long millis)
    : _seconds(secs), _milliseconds(millis) { }

  /**
   * Set the number of milliseconds in this Time object.
   *
   * @param millis - new milliseconds value
   * @return unsigned long old milliseconds value
   */
  unsigned long milliseconds(unsigned long millis) {

    unsigned long n = _milliseconds;
    _milliseconds = millis;

    return n;

  }

  /**
   * Set the number of seconds in this Time object.
   *
   * @param secs - new seconds value
   * @return unsigned long old seconds value
   */
  unsigned long seconds(unsigned long secs) {

    unsigned long n = _seconds;
    _seconds = secs;

    return n;

  }

 public:


  /**
   * Create a Time object with the current time relative to the
   * beginning of the program.
   */
  Time();

  /**
   * Create a Time object by copying another.
   *
   * @param t - Time object to copy.
   */
  Time(const Time& t)
    : _seconds(t._seconds), _milliseconds(t._milliseconds) { }


  /**
   * Get the number of milliseconds in this Time object.
   *
   * @return unsigned long milliseconds value
   */
  unsigned long milliseconds() const {
    return _milliseconds;
  }

  /**
   * Get the number of seconds in this Time object.
   *
   * @return unsigned long seconds value
   */
  unsigned long seconds() const {
    return _seconds;
  }

  /**
   * Add some number of milliseconds to this Time object.
   *
   * @param millis - number of milliseconds to add to this Time object
   * @return const Time& this object
   */
  const Time& operator+=(unsigned long millis) {

    _milliseconds += millis;
    _seconds += (_milliseconds / 1000);
    _milliseconds %= 1000;

    return *this;

  }

  /**
   * Subtract some number of milliseconds to this Time object.
   *
   * @param millis - number of milliseconds to subtract from this Time object
   * @return const Time& this object
   */
const Time& operator-=(unsigned long millis) {

    if(_milliseconds > millis)
      _milliseconds -= millis;

    else {

      while(_seconds > 0 && _milliseconds < millis) {

        _milliseconds += 1000;
        _seconds -= 1;

      }

      _milliseconds = (_milliseconds < millis) ? 0 : (_milliseconds - millis);

    }

    return *this;

}


  /**
   * Add the value of another Time object to this one.
   *
   * @param t - Time object whose value should be added to this object
   * @return const Time& this object
   */
  const Time& operator+=(const Time& t) {

    _milliseconds += t.milliseconds();
    _seconds += (_milliseconds / 1000) + t.seconds();
    _milliseconds %= 1000;

    return *this;

  }

  /**
   * Subtract the value of another Time object from this one.
   * This function has a floor of 0.
   *
   * @param t - Time object whose value should be subtracted from this object
   * @return const Time& this object
   */
const Time& operator-=(const Time& t) {

  unsigned long millis = t.milliseconds();
  unsigned long secs = t.seconds();

  if(_seconds >= secs) {

    if(_milliseconds > millis) {
      _milliseconds -= millis;
      _seconds -= secs;

    } else {

      while(_seconds > 0 && _milliseconds < millis) {

        _milliseconds += 1000;
        _seconds -= 1;

      }

      _milliseconds = (_milliseconds < millis) ? 0 : (_milliseconds - millis);
      _seconds = (_seconds < secs) ? 0 : (_seconds - secs);

    }

  } else {

    _milliseconds = 0;
    _seconds = 0;

  }

  return *this;

}

};



} // namespace ZThread

#endif // __ZTTIME_H__