This file is indexed.

/usr/include/bobcat/datetime is in libbobcat-dev 4.08.02-2build1.

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
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
#ifndef INCLUDED_BOBCAT_DATETIME_
#define INCLUDED_BOBCAT_DATETIME_

#include <ctime>
#include <iosfwd>

namespace FBB
{

class DateTime
{
    typedef struct tm TimeStruct;

    friend  std::ostream &operator<<(std::ostream &str, 
                                          DateTime const &dt);
    friend  std::istream &operator>>(std::istream &str, DateTime &dt);

    friend bool operator==(DateTime const &left, DateTime const &right);
    friend bool operator!=(DateTime const &left, DateTime const &right);
    friend bool operator<(DateTime const &left, DateTime const &right);
    friend bool operator<=(DateTime const &left, DateTime const &right);
    friend bool operator>(DateTime const &left, DateTime const &right);
    friend bool operator>=(DateTime const &left, DateTime const &right);

    public:
        enum TimeType
        {
            LOCALTIME,
            UTC
        };
        enum Month
        {
            JANUARY,
            FEBRUARY,
            MARCH,
            APRIL,
            MAY,
            JUNE,
            JULY,
            AUGUST,
            SEPTEMBER,
            OCTOBER,
            NOVEMBER,
            DECEMBER,
        };
        enum Relative
        {
            THIS_YEAR,
            LAST,
            NEXT,
            THIS_WEEK,
        };
        enum Weekday
        {
            SUNDAY,
            MONDAY,
            TUESDAY,
            WEDNESDAY,
            THURSDAY,
            FRIDAY,
            SATURDAY,
        };
        enum TriVal
        {
            UNKNOWN = -1,
            NO,
            YES
        };
        enum TimeFields
        {
            SECONDS  = 1 << 0,
            MINUTES  = 1 << 1,
            HOURS    = 1 << 2,
            MONTHDAY = 1 << 3,
            MONTH    = 1 << 4,
            YEAR     = 1 << 5
        };

    private:
    
        TimeType    d_type; // current type of info in d_tm member
                            // (LOCALTIME (implied when using displayZone) 
                            // or UTC)
    
        time_t      d_utcSec;           // time in seconds (UTC) 
        time_t      d_displayZoneShift; // correction to UTC when displaying
                                        // times
                                        // this takes care of dst as well.

        int         d_dstShift;         // 3600 or 0: add to displayZoneShift



        TimeStruct  d_tm;               // time's elements 


        bool        d_ok;
        size_t      d_errno;

        static char const *s_month[];
        static char const *s_day[];

    public:
        explicit DateTime(TimeType type = UTC); // 1. time displayed as 
                                                //    TimeType

        // shifts in minutes

        explicit DateTime(int tzShift);         // 2. LOCALTIME: 
                                                //    UTC + 
                                                //      tzShift (= TZ + DST)

                                                // 3. specify UTC/LOCAL time in 
        DateTime(time_t time, TimeType type);   //    seconds

                                                // 4. LOCALTIME: time (UTC) +
        DateTime(time_t time, int tzShift);     //      tzShift (= TZ + DST)


        // with TimeStruct tm constructor arguments dst, day of the year,
        //  day of the week are ignored:

                                                // 5. specify tm fields as
                                                //    either UTC or LOCALTIME
                                                //    using the default 
                                                //    tzShift
        DateTime(TimeStruct const &tm, TimeType type = UTC);

                                                // 6. specify UTC tm fields
                                                // display + tzShift
        DateTime(TimeStruct const &tm, int tzShift);

                                                // 7. specify UTC/LOCAL text 
                                                //    time
        explicit DateTime(std::string const &timeStr, TimeType type = UTC);

                                                // 7dep. Deprecated. Avoid
        DateTime(std::string const &timeStr, TimeType type, int);

                                                // 8. specify UTC text time
                                                //    display + 
                                                //      displayZoneShift
        DateTime(std::string const &timeStr, int tzShift);

                                                // 8dep.: Deprecated: avoid
        DateTime(std::string const &timeStr, int displayZoneShift, int);

        DateTime &operator+=(time_t seconds);           // 1.
        DateTime &operator+=(TimeStruct const &tm);     // 2. 

        DateTime &operator-=(time_t seconds);           // opsubis1.f
        DateTime &operator-=(TimeStruct const &tm);

        operator bool() const;                          // opbool.f

        bool setDay(int day);           // 'int' values may be negative or 
        bool setHours(int hours);       // postive.
        bool setMinutes(int minutes);   
        bool setMonth(Month month, Relative where = THIS_YEAR);
        bool setMonth(int month);       // set month, using 0: january this yr
                                        // correct for overflows.
        bool setSeconds(int seconds);
        bool setTime(time_t time);      // utc time
        bool setWeekday(Weekday weekday, Relative where = NEXT);
        bool setYear(size_t year);
        bool setFields(TimeStruct const &tmStruct, int fields);
        void setValid();                                            // .f

        int displayZoneShift() const;                               // .f
        TriVal dst() const;                                         // .f
        size_t error() const;                                       // .f
        size_t hours() const;                                       // .f
        size_t minutes() const;                                     // .f
        Month month() const;                                        // .f
        size_t monthDayNr() const;                                  // .f
        std::string rfc2822() const;
        std::string rfc3339() const;
        size_t seconds() const;                                     // .f
        time_t time() const;                                        // .f
        TimeStruct const *timeStruct() const;                       // .f
        bool valid() const;                                         // .f
        Weekday weekday() const;                                    // .f
        size_t year() const;                                        // .f
        size_t yearDay() const;             // starts counting at 0    .f
        size_t yearDayNr() const;           // starts counting at 1    .f
        size_t weekNr() const;              // starts counting at 1

        
        DateTime utc() const;                                       // .f
        DateTime localTime() const;                                 // .f
        DateTime to(TimeType type) const;

        DateTime timeZoneShift(int displayZoneShift) const;         // .f

    private:
            // used by constructors
        void d_tm2d_tm(int displayZoneShift);   // cons 6, 8
        void d_tm2timeType();                   // cons 5, 7

        void d_tm2utcSec();
        void displayShift2d_tm();

        bool updateTime(TimeStruct &tm);

        void setDisplayZone(time_t displayZoneShift);
        void parse(std::istream &in);
        void parseFromDayName(std::istream &in);
        std::ostream &timeStr(std::ostream &out) const;

        time_t timeStruct2utcSec(TimeStruct *ts);           // sets d_ok
        void utcSec2timeStruct(TimeStruct *ts,              // sets d_ok    .f
                                            time_t time);    
        
        int dstCorrection(bool *ok) const;
        int dstCorrection();

        time_t defaultDisplayZoneShift() const;     // seconds

        static int zoneShiftSeconds(int shiftMinutes);              // .f
                                                // shifts multiples of 30'
                                                // at most +/-12 hours away
};

inline int DateTime::displayZoneShift() const
{
    return d_displayZoneShift;
}
inline DateTime::TriVal DateTime::dst() const
{
    return static_cast<TriVal>(d_tm.tm_isdst);  
}
inline size_t DateTime::error() const
{
    return d_errno;
}
inline size_t DateTime::hours() const
{
    return d_tm.tm_hour;
}
inline DateTime DateTime::localTime() const
{
    return to(LOCALTIME);
}   
inline size_t DateTime::minutes() const
{
    return d_tm.tm_min;
}
inline DateTime::Month DateTime::month() const
{
    return static_cast<Month>(d_tm.tm_mon);
}
inline size_t DateTime::monthDayNr() const
{
    return d_tm.tm_mday;
}
inline DateTime::operator bool() const
{
    return d_ok;
}
inline DateTime &DateTime::operator-=(time_t seconds)
{
    return operator+=(-seconds);
}
inline size_t DateTime::seconds() const
{
    return d_tm.tm_sec;
}
inline void DateTime::setValid()
{
    d_ok = true;
}
inline time_t DateTime::time() const
{
    return d_utcSec;
}
inline struct tm const *DateTime::timeStruct() const
{
    return &d_tm;
}
inline DateTime DateTime::timeZoneShift(int displayZoneShift) const
{
    return DateTime(d_utcSec, displayZoneShift);
}
inline DateTime DateTime::utc() const
{
    return to(UTC);
}   
inline bool DateTime::valid() const
{
    return d_ok;
}
inline DateTime::Weekday DateTime::weekday() const
{
    return static_cast<Weekday>(d_tm.tm_wday);
}
inline size_t DateTime::year() const
{
    return d_tm.tm_year + 1900;
}
inline size_t DateTime::yearDay() const
{
    return d_tm.tm_yday;
}
inline size_t DateTime::yearDayNr() const
{
    return d_tm.tm_yday + 1;
}

// Free functions

inline DateTime operator+(DateTime const &left,   // d_type
                               time_t right)
{
    return DateTime(left) += right;
}   
inline DateTime operator+(DateTime const &left,   // d_type
                               tm const &right)
{
    return DateTime(left) += right;
}   
inline bool operator==(DateTime const &left, DateTime const &right)
{
    return left.d_utcSec == right.d_utcSec;
}   
inline bool operator>=(DateTime const &left, DateTime const &right)
{
    return left.d_utcSec >= right.d_utcSec;
}   
inline bool operator>(DateTime const &left, DateTime const &right)
{
    return left.d_utcSec > right.d_utcSec;
}   
inline bool operator<=(DateTime const &left, DateTime const &right)
{
    return left.d_utcSec <= right.d_utcSec;
}   
inline bool operator<(DateTime const &left, DateTime const &right)
{
    return left.d_utcSec < right.d_utcSec;
}   
inline bool operator!=(DateTime const &left, DateTime const &right)
{
    return left.d_utcSec != right.d_utcSec;
}   
inline DateTime operator-(DateTime const &left,   // d_type
                               time_t right)
{
    return DateTime(left) -= right;
}   
inline DateTime operator-(DateTime const &left,   // d_type
                               tm const &right)
{
    return DateTime(left) -= right;
}   

}   // FBB

#endif