/usr/include/barry18/barry/time.h is in libbarry-dev 0.18.5-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 | ///
/// \file time.h
/// Time related conversion routines.
/// time_t is the POSIX time.
/// min1900_t is the minutes from Jan 1, 1900
///
/*
Copyright (C) 2005-2013, Net Direct Inc. (http://www.netdirect.ca/)
This program 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 program 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 in the COPYING file at the
root directory of this project for more details.
*/
#ifndef __BARRY_TIME_H__
#define __BARRY_TIME_H__
#include "dll.h"
#include <sys/time.h> // for struct timespec
#include <time.h>
#include <stdint.h>
//
// Calculate the number of minutes between Jan 01, 1900 and Jan 01, 1970
//
// There are 17 leap years between 1900 and 1970
// (1969-1900) / 4 = 17.25
//
// 1900 itself is not a leap year (not divisible by 400)
//
#define DAY_MINUTES (24 * 60)
#define YEAR_MINUTES (365 * DAY_MINUTES)
#define LEAP_YEAR_COUNT ((1970-1901) / 4)
#define YEAR_COUNT (1970 - 1900)
// therefore, the difference between standard C's time and min1900_t's
// time in minutes:
#define STDC_MIN1900_DIFF (YEAR_COUNT * YEAR_MINUTES + LEAP_YEAR_COUNT * DAY_MINUTES)
namespace Barry {
typedef long min1900_t;
BXEXPORT min1900_t time2min(time_t t);
BXEXPORT time_t min2time(min1900_t m);
// FIXME - turn StaticTimeZone into a C typedef and wrap this in extern "C"
// so the data can be used in both C and C++ libraries
//
// This is named StaticTimeZone since the time zone table is hard coded
// in the library. If you want to know what the device's idea of time zones
// is, then extract the time zone database using the TimeZone record class.
//
// See also the TimeZones class, which unifies access to the static and
// dynamic time zone tables in one class API.
//
struct BXEXPORT StaticTimeZone
{
uint16_t Code;
signed short HourOffset;
signed short MinOffset;
const char *Name;
};
// FIXME - put this somewhere for both C and C++
#define STATIC_TIME_ZONE_CODE_ERR 0xffff
BXEXPORT const StaticTimeZone* GetStaticTimeZoneTable();
BXEXPORT const StaticTimeZone* GetStaticTimeZone(uint16_t Code);
BXEXPORT unsigned short GetStaticTimeZoneCode(signed short HourOffset,
signed short MinOffset = 0);
// Message time conversion stuff
BXEXPORT time_t DayToDate( uint16_t Day );
BXEXPORT time_t Message2Time(uint16_t r_date, uint16_t r_time);
// Thread timeout creation
BXEXPORT struct timespec* ThreadTimeout(int timeout_ms, struct timespec *spec);
// Utility functions
BXEXPORT int DaysInMonth(struct tm &t);
} // namespace Barry
#endif
|