Slide 63
Slide 63 text
php-src: DateTimeZone実装
ext/date/php_date.c からのPHPクラスインターフェース:
/* DateTimeZoneクラスのメソッドテーブル */
static const zend_function_entry date_timezone_methods[] = {
PHP_ME(DateTimeZone, __construct, arginfo_timezone_construct, ZEND_ACC_PUBLIC)
PHP_ME(DateTimeZone, getName, arginfo_timezone_void, ZEND_ACC_PUBLIC)
PHP_ME(DateTimeZone, getOffset, arginfo_timezone_getoffset, ZEND_ACC_PUBLIC)
PHP_ME(DateTimeZone, getTransitions, arginfo_timezone_gettransitions, ZEND_ACC_PUBLIC)
/* ... */
};
/* getTransitionsメソッドの実装 */
PHP_METHOD(DateTimeZone, getTransitions)
{
/* ... */
/* タイムゾーン情報からすべての移行情報を取得 */
for (i = 0; i < tz->timecnt; i++) {
/* 各移行時間を配列として返す */
array_init(&element);
add_assoc_long(&element, "ts", tz->trans[i]);
add_assoc_string(&element, "time", timelib_time_to_string(dummy));
/* ... */
2025-04-12 スー | PHP Conference Odawara 2025 63