Annotation of embedaddon/php/ext/date/lib/timelib.h, revision 1.1.1.4
1.1 misho 1: /*
2: +----------------------------------------------------------------------+
3: | PHP Version 5 |
4: +----------------------------------------------------------------------+
1.1.1.4 ! misho 5: | Copyright (c) 1997-2014 The PHP Group |
1.1 misho 6: +----------------------------------------------------------------------+
7: | This source file is subject to version 3.01 of the PHP license, |
8: | that is bundled with this package in the file LICENSE, and is |
9: | available through the world-wide-web at the following url: |
10: | http://www.php.net/license/3_01.txt |
11: | If you did not receive a copy of the PHP license and are unable to |
12: | obtain it through the world-wide-web, please send a note to |
13: | license@php.net so we can mail you a copy immediately. |
14: +----------------------------------------------------------------------+
15: | Authors: Derick Rethans <derick@derickrethans.nl> |
16: +----------------------------------------------------------------------+
17: */
18:
1.1.1.2 misho 19: /* $Id$ */
1.1 misho 20:
21: #ifndef __TIMELIB_H__
22: #define __TIMELIB_H__
23:
24: #include "timelib_structs.h"
25: #if HAVE_LIMITS_H
26: #include <limits.h>
27: #endif
28:
29: #define TIMELIB_VERSION 201102
30:
31: #define TIMELIB_NONE 0x00
32: #define TIMELIB_OVERRIDE_TIME 0x01
33: #define TIMELIB_NO_CLONE 0x02
34:
35: #define TIMELIB_UNSET -99999
36:
37: #define TIMELIB_SPECIAL_WEEKDAY 0x01
38: #define TIMELIB_SPECIAL_DAY_OF_WEEK_IN_MONTH 0x02
39: #define TIMELIB_SPECIAL_LAST_DAY_OF_WEEK_IN_MONTH 0x03
40:
41: #ifndef LONG_MAX
42: #define LONG_MAX 2147483647L
43: #endif
44:
45: #ifndef LONG_MIN
46: #define LONG_MIN (- LONG_MAX - 1)
47: #endif
48:
49: #if defined(_MSC_VER) && !defined(strcasecmp)
50: #define strcasecmp stricmp
51: #endif
52:
53: #if defined(_MSC_VER) && !defined(strncasecmp)
54: #define strncasecmp strnicmp
55: #endif
56:
57: /* Function pointers */
58: typedef timelib_tzinfo* (*timelib_tz_get_wrapper)(char *tzname, const timelib_tzdb *tzdb);
59:
60: /* From dow.c */
61: timelib_sll timelib_day_of_week(timelib_sll y, timelib_sll m, timelib_sll d);
62: timelib_sll timelib_iso_day_of_week(timelib_sll y, timelib_sll m, timelib_sll d);
63: timelib_sll timelib_day_of_year(timelib_sll y, timelib_sll m, timelib_sll d);
64: timelib_sll timelib_daynr_from_weeknr(timelib_sll y, timelib_sll w, timelib_sll d);
65: timelib_sll timelib_days_in_month(timelib_sll y, timelib_sll m);
66: void timelib_isoweek_from_date(timelib_sll y, timelib_sll m, timelib_sll d, timelib_sll *iw, timelib_sll *iy);
67: int timelib_valid_time(timelib_sll h, timelib_sll i, timelib_sll s);
68: int timelib_valid_date(timelib_sll y, timelib_sll m, timelib_sll d);
69:
70: /* From parse_date.re */
71: timelib_time *timelib_strtotime(char *s, int len, timelib_error_container **errors, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_get_wrapper);
72: timelib_time *timelib_parse_from_format(char *format, char *s, int len, timelib_error_container **errors, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_get_wrapper);
73: void timelib_fill_holes(timelib_time *parsed, timelib_time *now, int options);
74: char *timelib_timezone_id_from_abbr(const char *abbr, long gmtoffset, int isdst);
75: const timelib_tz_lookup_table *timelib_timezone_abbreviations_list(void);
76:
77: /* From parse_iso_intervals.re */
78: void timelib_strtointerval(char *s, int len,
79: timelib_time **begin, timelib_time **end,
80: timelib_rel_time **period, int *recurrences,
81: struct timelib_error_container **errors);
82:
83:
84: /* From tm2unixtime.c */
85: void timelib_update_ts(timelib_time* time, timelib_tzinfo* tzi);
86: void timelib_do_normalize(timelib_time *base);
87: void timelib_do_rel_normalize(timelib_time *base, timelib_rel_time *rt);
88:
89: /* From unixtime2tm.c */
90: int timelib_apply_localtime(timelib_time *t, unsigned int localtime);
91: void timelib_unixtime2gmt(timelib_time* tm, timelib_sll ts);
92: void timelib_unixtime2local(timelib_time *tm, timelib_sll ts);
93: void timelib_update_from_sse(timelib_time *tm);
1.1.1.4 ! misho 94: void timelib_set_timezone_from_offset(timelib_time *t, timelib_sll utc_offset);
! 95: void timelib_set_timezone_from_abbr(timelib_time *t, timelib_abbr_info abbr_info);
1.1 misho 96: void timelib_set_timezone(timelib_time *t, timelib_tzinfo *tz);
97:
98: /* From parse_tz.c */
99: int timelib_timezone_id_is_valid(char *timezone, const timelib_tzdb *tzdb);
100: timelib_tzinfo *timelib_parse_tzfile(char *timezone, const timelib_tzdb *tzdb);
101: int timelib_timestamp_is_in_dst(timelib_sll ts, timelib_tzinfo *tz);
102: timelib_time_offset *timelib_get_time_zone_info(timelib_sll ts, timelib_tzinfo *tz);
103: timelib_sll timelib_get_current_offset(timelib_time *t);
104: void timelib_dump_tzinfo(timelib_tzinfo *tz);
105: const timelib_tzdb *timelib_builtin_db(void);
106: const timelib_tzdb_index_entry *timelib_timezone_builtin_identifiers_list(int *count);
107:
108: /* From timelib.c */
109: timelib_tzinfo* timelib_tzinfo_ctor(char *name);
110: void timelib_time_tz_abbr_update(timelib_time* tm, char* tz_abbr);
111: void timelib_time_tz_name_update(timelib_time* tm, char* tz_name);
112: void timelib_tzinfo_dtor(timelib_tzinfo *tz);
113: timelib_tzinfo* timelib_tzinfo_clone(timelib_tzinfo *tz);
114:
115: timelib_rel_time* timelib_rel_time_ctor(void);
116: void timelib_rel_time_dtor(timelib_rel_time* t);
117: timelib_rel_time* timelib_rel_time_clone(timelib_rel_time *tz);
118:
119: timelib_time* timelib_time_ctor(void);
120: void timelib_time_set_option(timelib_time* tm, int option, void* option_value);
121: void timelib_time_dtor(timelib_time* t);
122: timelib_time* timelib_time_clone(timelib_time* orig);
123:
124: timelib_time_offset* timelib_time_offset_ctor(void);
125: void timelib_time_offset_dtor(timelib_time_offset* t);
126:
127: void timelib_error_container_dtor(timelib_error_container *errors);
128:
129: signed long timelib_date_to_int(timelib_time *d, int *error);
130: void timelib_dump_date(timelib_time *d, int options);
131: void timelib_dump_rel_time(timelib_rel_time *d);
132:
133: void timelib_decimal_hour_to_hms(double h, int *hour, int *min, int *sec);
134:
135: /* from astro.c */
136: double timelib_ts_to_juliandate(timelib_sll ts);
137: int timelib_astro_rise_set_altitude(timelib_time *time, double lon, double lat, double altit, int upper_limb, double *h_rise, double *h_set, timelib_sll *ts_rise, timelib_sll *ts_set, timelib_sll *ts_transit);
138:
139: /* from interval.c */
140: timelib_rel_time *timelib_diff(timelib_time *one, timelib_time *two);
1.1.1.4 ! misho 141: timelib_time *timelib_add(timelib_time *t, timelib_rel_time *interval);
! 142: timelib_time *timelib_sub(timelib_time *t, timelib_rel_time *interval);
1.1 misho 143:
144: #endif
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>