time.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef __BARRY_TIME_H__
00025 #define __BARRY_TIME_H__
00026
00027 #include "dll.h"
00028 #include <sys/time.h>
00029 #include <time.h>
00030 #include <stdint.h>
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 #define DAY_MINUTES (24 * 60)
00041 #define YEAR_MINUTES (365 * DAY_MINUTES)
00042 #define LEAP_YEAR_COUNT ((1970-1901) / 4)
00043 #define YEAR_COUNT (1970 - 1900)
00044
00045
00046
00047 #define STDC_MIN1900_DIFF (YEAR_COUNT * YEAR_MINUTES + LEAP_YEAR_COUNT * DAY_MINUTES)
00048
00049 namespace Barry {
00050
00051 typedef long min1900_t;
00052
00053 BXEXPORT min1900_t time2min(time_t t);
00054 BXEXPORT time_t min2time(min1900_t m);
00055
00056
00057
00058 struct BXEXPORT TimeZone
00059 {
00060 unsigned short Code;
00061 signed short HourOffset;
00062 signed short MinOffset;
00063 const char *Name;
00064 };
00065
00066
00067 #define TIME_ZONE_CODE_ERR 0xffff
00068
00069 BXEXPORT const TimeZone* GetTimeZoneTable();
00070 BXEXPORT const TimeZone* GetTimeZone(unsigned short Code);
00071 BXEXPORT unsigned short GetTimeZoneCode(signed short HourOffset,
00072 signed short MinOffset = 0);
00073
00074
00075 BXEXPORT time_t DayToDate( unsigned short Day );
00076 BXEXPORT time_t Message2Time(uint16_t r_date, uint16_t r_time);
00077
00078
00079 BXEXPORT struct timespec* ThreadTimeout(int timeout_ms, struct timespec *spec);
00080
00081 }
00082
00083 #endif
00084