Annotation of embedaddon/php/ext/date/php_date.h, revision 1.1.1.4
1.1 misho 1: /*
2: +----------------------------------------------------------------------+
3: | PHP Version 5 |
4: +----------------------------------------------------------------------+
1.1.1.3 misho 5: | Copyright (c) 1997-2013 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 PHP_DATE_H
22: #define PHP_DATE_H
23:
24: #include "lib/timelib.h"
25: #include "Zend/zend_hash.h"
26:
27: extern zend_module_entry date_module_entry;
28: #define phpext_date_ptr &date_module_entry
29:
30: PHP_FUNCTION(date);
31: PHP_FUNCTION(idate);
32: PHP_FUNCTION(gmdate);
33: PHP_FUNCTION(strtotime);
34:
35: PHP_FUNCTION(mktime);
36: PHP_FUNCTION(gmmktime);
37:
38: PHP_FUNCTION(checkdate);
39:
40: #ifdef HAVE_STRFTIME
41: PHP_FUNCTION(strftime);
42: PHP_FUNCTION(gmstrftime);
43: #endif
44:
45: PHP_FUNCTION(time);
46: PHP_FUNCTION(localtime);
47: PHP_FUNCTION(getdate);
48:
49: /* Advanced Interface */
50: PHP_METHOD(DateTime, __construct);
51: PHP_METHOD(DateTime, __wakeup);
52: PHP_METHOD(DateTime, __set_state);
53: PHP_FUNCTION(date_create);
54: PHP_FUNCTION(date_create_from_format);
55: PHP_FUNCTION(date_parse);
56: PHP_FUNCTION(date_parse_from_format);
57: PHP_FUNCTION(date_get_last_errors);
58: PHP_FUNCTION(date_format);
59: PHP_FUNCTION(date_modify);
60: PHP_FUNCTION(date_add);
61: PHP_FUNCTION(date_sub);
62: PHP_FUNCTION(date_timezone_get);
63: PHP_FUNCTION(date_timezone_set);
64: PHP_FUNCTION(date_offset_get);
65: PHP_FUNCTION(date_diff);
66:
67: PHP_FUNCTION(date_time_set);
68: PHP_FUNCTION(date_date_set);
69: PHP_FUNCTION(date_isodate_set);
70: PHP_FUNCTION(date_timestamp_set);
71: PHP_FUNCTION(date_timestamp_get);
72:
73: PHP_METHOD(DateTimeZone, __construct);
74: PHP_FUNCTION(timezone_open);
75: PHP_FUNCTION(timezone_name_get);
76: PHP_FUNCTION(timezone_name_from_abbr);
77: PHP_FUNCTION(timezone_offset_get);
78: PHP_FUNCTION(timezone_transitions_get);
79: PHP_FUNCTION(timezone_location_get);
80: PHP_FUNCTION(timezone_identifiers_list);
81: PHP_FUNCTION(timezone_abbreviations_list);
82: PHP_FUNCTION(timezone_version_get);
83:
84: PHP_METHOD(DateInterval, __construct);
85: PHP_METHOD(DateInterval, __wakeup);
86: PHP_METHOD(DateInterval, __set_state);
87: PHP_FUNCTION(date_interval_format);
88: PHP_FUNCTION(date_interval_create_from_date_string);
89:
90: PHP_METHOD(DatePeriod, __construct);
1.1.1.3 misho 91: PHP_METHOD(DatePeriod, __wakeup);
92: PHP_METHOD(DatePeriod, __set_state);
1.1 misho 93:
94: /* Options and Configuration */
95: PHP_FUNCTION(date_default_timezone_set);
96: PHP_FUNCTION(date_default_timezone_get);
97:
98: /* Astro functions */
99: PHP_FUNCTION(date_sunrise);
100: PHP_FUNCTION(date_sunset);
101: PHP_FUNCTION(date_sun_info);
102:
103: PHP_RINIT_FUNCTION(date);
104: PHP_RSHUTDOWN_FUNCTION(date);
105: PHP_MINIT_FUNCTION(date);
106: PHP_MSHUTDOWN_FUNCTION(date);
107: PHP_MINFO_FUNCTION(date);
108:
109: typedef struct _php_date_obj php_date_obj;
110: typedef struct _php_timezone_obj php_timezone_obj;
111: typedef struct _php_interval_obj php_interval_obj;
112: typedef struct _php_period_obj php_period_obj;
113:
114: struct _php_date_obj {
115: zend_object std;
116: timelib_time *time;
117: HashTable *props;
118: };
119:
120: struct _php_timezone_obj {
121: zend_object std;
122: int initialized;
123: int type;
124: union {
125: timelib_tzinfo *tz; /* TIMELIB_ZONETYPE_ID; */
126: timelib_sll utc_offset; /* TIMELIB_ZONETYPE_OFFSET */
127: struct /* TIMELIB_ZONETYPE_ABBR */
128: {
129: timelib_sll utc_offset;
130: char *abbr;
131: int dst;
132: } z;
133: } tzi;
134: };
135:
136: struct _php_interval_obj {
137: zend_object std;
138: timelib_rel_time *diff;
139: HashTable *props;
140: int initialized;
141: };
142:
143: struct _php_period_obj {
144: zend_object std;
145: timelib_time *start;
146: timelib_time *current;
147: timelib_time *end;
148: timelib_rel_time *interval;
149: int recurrences;
150: int initialized;
151: int include_start_date;
152: };
153:
154: ZEND_BEGIN_MODULE_GLOBALS(date)
1.1.1.3 misho 155: char *default_timezone;
156: char *timezone;
157: HashTable *tzcache;
1.1 misho 158: timelib_error_container *last_errors;
1.1.1.3 misho 159: int timezone_valid;
1.1 misho 160: ZEND_END_MODULE_GLOBALS(date)
161:
162: #ifdef ZTS
163: #define DATEG(v) TSRMG(date_globals_id, zend_date_globals *, v)
164: #else
165: #define DATEG(v) (date_globals.v)
166: #endif
167:
1.1.1.4 ! misho 168: /* Backwards compatibility wrapper */
1.1 misho 169: PHPAPI signed long php_parse_date(char *string, signed long *now);
170: PHPAPI void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gmt);
1.1.1.2 misho 171: PHPAPI int php_idate(char format, time_t ts, int localtime TSRMLS_DC);
1.1 misho 172: #if HAVE_STRFTIME
173: #define _php_strftime php_strftime
174: PHPAPI void php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gm);
175: #endif
176: PHPAPI char *php_format_date(char *format, int format_len, time_t ts, int localtime TSRMLS_DC);
177:
178: /* Mechanism to set new TZ database */
179: PHPAPI void php_date_set_tzdb(timelib_tzdb *tzdb);
180: PHPAPI timelib_tzinfo *get_timezone_info(TSRMLS_D);
181:
182: /* Grabbing CE's so that other exts can use the date objects too */
183: PHPAPI zend_class_entry *php_date_get_date_ce(void);
184: PHPAPI zend_class_entry *php_date_get_timezone_ce(void);
185:
186: /* Functions for creating DateTime objects, and initializing them from a string */
187: PHPAPI zval *php_date_instantiate(zend_class_entry *pce, zval *object TSRMLS_DC);
188: PHPAPI int php_date_initialize(php_date_obj *dateobj, /*const*/ char *time_str, int time_str_len, char *format, zval *timezone_object, int ctor TSRMLS_DC);
189:
190:
191: #endif /* PHP_DATE_H */
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>