Annotation of embedaddon/php/ext/date/php_date.h, revision 1.1.1.5
1.1 misho 1: /*
2: +----------------------------------------------------------------------+
3: | PHP Version 5 |
4: +----------------------------------------------------------------------+
1.1.1.5 ! 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 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 {
1.1.1.5 ! misho 125: timelib_tzinfo *tz; /* TIMELIB_ZONETYPE_ID */
! 126: timelib_sll utc_offset; /* TIMELIB_ZONETYPE_OFFSET */
! 127: timelib_abbr_info z; /* TIMELIB_ZONETYPE_ABBR */
1.1 misho 128: } tzi;
129: };
130:
131: struct _php_interval_obj {
132: zend_object std;
133: timelib_rel_time *diff;
134: HashTable *props;
135: int initialized;
136: };
137:
138: struct _php_period_obj {
139: zend_object std;
140: timelib_time *start;
141: timelib_time *current;
142: timelib_time *end;
143: timelib_rel_time *interval;
144: int recurrences;
145: int initialized;
146: int include_start_date;
147: };
148:
149: ZEND_BEGIN_MODULE_GLOBALS(date)
1.1.1.3 misho 150: char *default_timezone;
151: char *timezone;
152: HashTable *tzcache;
1.1 misho 153: timelib_error_container *last_errors;
1.1.1.3 misho 154: int timezone_valid;
1.1 misho 155: ZEND_END_MODULE_GLOBALS(date)
156:
157: #ifdef ZTS
158: #define DATEG(v) TSRMG(date_globals_id, zend_date_globals *, v)
159: #else
160: #define DATEG(v) (date_globals.v)
161: #endif
162:
1.1.1.4 misho 163: /* Backwards compatibility wrapper */
1.1 misho 164: PHPAPI signed long php_parse_date(char *string, signed long *now);
165: PHPAPI void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gmt);
1.1.1.2 misho 166: PHPAPI int php_idate(char format, time_t ts, int localtime TSRMLS_DC);
1.1 misho 167: #if HAVE_STRFTIME
168: #define _php_strftime php_strftime
169: PHPAPI void php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gm);
170: #endif
171: PHPAPI char *php_format_date(char *format, int format_len, time_t ts, int localtime TSRMLS_DC);
172:
173: /* Mechanism to set new TZ database */
174: PHPAPI void php_date_set_tzdb(timelib_tzdb *tzdb);
175: PHPAPI timelib_tzinfo *get_timezone_info(TSRMLS_D);
176:
177: /* Grabbing CE's so that other exts can use the date objects too */
178: PHPAPI zend_class_entry *php_date_get_date_ce(void);
179: PHPAPI zend_class_entry *php_date_get_timezone_ce(void);
180:
181: /* Functions for creating DateTime objects, and initializing them from a string */
182: PHPAPI zval *php_date_instantiate(zend_class_entry *pce, zval *object TSRMLS_DC);
183: 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);
184:
185:
186: #endif /* PHP_DATE_H */
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>