├── .github
└── workflows
│ └── build.yml
├── .gitignore
├── CREDITS
├── LICENSE
├── README.rst
├── composer.json
├── config.m4
├── config.w32
├── package.xml
├── php_timezonedb.h
├── rebuild.sh
├── timezonedb.c
└── timezonedb.h
/.github/workflows/build.yml:
--------------------------------------------------------------------------------
1 | name: Build
2 |
3 | on:
4 | push:
5 | branches: [master]
6 | pull_request:
7 | release:
8 | types: [created]
9 | create:
10 |
11 | jobs:
12 | windows:
13 | runs-on: windows-latest
14 | name: "Windows: Build and test"
15 | defaults:
16 | run:
17 | shell: cmd
18 | strategy:
19 | fail-fast: false
20 | matrix:
21 | php: ["7.3", "7.4", "8.0", "8.1", "8.2", "8.3"]
22 | arch: [x86, x64]
23 | ts: [nts, ts]
24 | experimental: [false]
25 | steps:
26 | - name: Checkout Repository
27 | uses: actions/checkout@v3
28 | - name: Extract Version
29 | shell: powershell
30 | run: |
31 | chcp 65001
32 | $r = Select-String -Path php_timezonedb.h -Pattern 'PHP_TIMEZONEDB_VERSION\s+"(.*)"'
33 | $s = $r.Matches[0].Groups[1]
34 | echo "$s"
35 | $extension_version = 'EXTENSION_VERSION=' + $s
36 | echo $extension_version >> $env:GITHUB_ENV
37 | - name: Setup PHP
38 | id: setup-php
39 | uses: php/setup-php-sdk@v0.8
40 | with:
41 | version: ${{matrix.php}}
42 | arch: ${{matrix.arch}}
43 | ts: ${{matrix.ts}}
44 | - name: Enable Developer Command Prompt
45 | uses: ilammy/msvc-dev-cmd@v1
46 | with:
47 | arch: ${{matrix.arch}}
48 | toolset: ${{steps.setup-php.outputs.toolset}}
49 | - name: Generate Build Files
50 | run: phpize
51 | - name: Configure Build
52 | run: configure --enable-timezonedb --with-prefix=${{steps.setup-php.outputs.prefix}}
53 | - name: Build
54 | run: nmake
55 | - name: Define Module Env
56 | shell: powershell
57 | run: |
58 | chcp 65001
59 |
60 | $dir = (Get-Location).Path + '\'
61 | if ('x64' -eq '${{matrix.arch}}') { $dir = $dir + 'x64\' }
62 | $dir = $dir + 'Release'
63 | if ('ts' -eq '${{matrix.ts}}') { $dir = $dir + '_TS' }
64 |
65 | $artifact_name = 'php_timezonedb-${{env.EXTENSION_VERSION}}-${{matrix.php}}'
66 |
67 | if ('7.2' -eq '${{matrix.php}}') { $artifact_name = $artifact_name + '-vc15' }
68 | if ('7.3' -eq '${{matrix.php}}') { $artifact_name = $artifact_name + '-vc15' }
69 | if ('7.4' -eq '${{matrix.php}}') { $artifact_name = $artifact_name + '-vc15' }
70 | if ('8.0' -eq '${{matrix.php}}') { $artifact_name = $artifact_name + '-vs16' }
71 | if ('8.1' -eq '${{matrix.php}}') { $artifact_name = $artifact_name + '-vs16' }
72 | if ('8.2' -eq '${{matrix.php}}') { $artifact_name = $artifact_name + '-vs16' }
73 |
74 | if ('nts' -eq '${{matrix.ts}}') { $artifact_name = $artifact_name + '-nts' }
75 | if ('x64' -eq '${{matrix.arch}}') { $artifact_name = $artifact_name + '-x86_64' }
76 |
77 | $extension_artifact_name = "ARTIFACT_NAME=" + $artifact_name
78 | echo $extension_artifact_name >> $env:GITHUB_ENV
79 |
80 | $from = $dir + '\php_timezonedb.dll'
81 | $to = $dir + '\' + $artifact_name + ".dll"
82 | Copy-Item $from -Destination $to
83 | $extension_artifact = "ARTIFACT=" + $to
84 | echo $extension_artifact >> $env:GITHUB_ENV
85 |
86 | - name: Upload artifacts
87 | uses: actions/upload-artifact@v3
88 | with:
89 | name: ${{env.ARTIFACT_NAME}}
90 | path: ${{env.ARTIFACT}}
91 |
92 | - name: Publish Binaries to Release
93 | if: ${{ startsWith(github.ref, 'refs/tags') }}
94 | uses: svenstaro/upload-release-action@v2
95 | with:
96 | asset_name: ${{env.ARTIFACT_NAME}}.dll
97 | file: ${{env.ARTIFACT}}
98 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /.deps
2 | /Makefile
3 | /*.dep
4 | /*.lo
5 | /*.loT
6 | /*.slo
7 | /*.mk
8 | /*.la
9 | /.libs
10 | src/*.dep
11 | src/*.lo
12 | src/*.loT
13 | src/.libs
14 | src/*/*.dep
15 | src/*/*.lo
16 | src/*/*.loT
17 | src/*/.libs
18 | /libs.mk
19 | /ac*.m4
20 | /build
21 | /config.h
22 | /config.h.in
23 | /config.nice
24 | /config.sub
25 | /configure
26 | /configure.ac
27 | /configure.in
28 | /config.status
29 | /config.cache
30 | /conftest
31 | /conftest.c
32 | /core
33 | /dynlib.m4
34 | /install-sh
35 | /ltmain.sh
36 | /include
37 | /Makefile.fragments
38 | /Makefile.global
39 | /Makefile.objects
40 | /missing
41 | /mkinstalldirs
42 | /modules
43 | /scan_makefile_in.awk
44 | /config.guess
45 | /*sw*
46 | /contrib/*sw*
47 | tags
48 | /config.log
49 | /libtool
50 | /Debug
51 | /Release
52 | /Debug_TS
53 | /Release_TS
54 | /*.plg
55 | /*.patch
56 | /*.tgz
57 | /*.ncb
58 | /*.opt
59 | /*.dsw
60 | /autom4te.cache
61 | /run-tests-config.php
62 | /run-tests.php
63 | /tmp-php.ini
64 | .svn
65 | /*~
66 | /*.rej
67 |
68 | # Test files generated by `run-tests.php`
69 | *.diff
70 | *.mem
71 | *.log
72 | *.out
73 | *.exp
74 | *.swp
75 | *.php
76 | *.sh
77 | phpt.*
78 | /C:\\Windows\\Temp\\remote-log4.txt
79 |
80 | # Exclude files we like
81 | !php_xdebug.stub.php
82 | !run-xdebug-tests.php
83 | !make-release.php
84 |
--------------------------------------------------------------------------------
/CREDITS:
--------------------------------------------------------------------------------
1 | timezonedb
2 | Derick Rethans
3 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | This extension includes code and data from the Time Zone Database
2 | (http://www.iana.org/time-zones). These code and data are placed
3 | in public domain.
4 |
5 | This extension also includes code under The PHP License 3.01,
6 | hereby reproduced:
7 |
8 | --------------------------------------------------------------------
9 | The PHP License, version 3.01
10 | Copyright (c) 1999 - 2014 The PHP Group. All rights reserved.
11 | --------------------------------------------------------------------
12 |
13 | Redistribution and use in source and binary forms, with or without
14 | modification, is permitted provided that the following conditions
15 | are met:
16 |
17 | 1. Redistributions of source code must retain the above copyright
18 | notice, this list of conditions and the following disclaimer.
19 |
20 | 2. Redistributions in binary form must reproduce the above copyright
21 | notice, this list of conditions and the following disclaimer in
22 | the documentation and/or other materials provided with the
23 | distribution.
24 |
25 | 3. The name "PHP" must not be used to endorse or promote products
26 | derived from this software without prior written permission. For
27 | written permission, please contact group@php.net.
28 |
29 | 4. Products derived from this software may not be called "PHP", nor
30 | may "PHP" appear in their name, without prior written permission
31 | from group@php.net. You may indicate that your software works in
32 | conjunction with PHP by saying "Foo for PHP" instead of calling
33 | it "PHP Foo" or "phpfoo"
34 |
35 | 5. The PHP Group may publish revised and/or new versions of the
36 | license from time to time. Each version will be given a
37 | distinguishing version number.
38 | Once covered code has been published under a particular version
39 | of the license, you may always continue to use it under the terms
40 | of that version. You may also choose to use such covered code
41 | under the terms of any subsequent version of the license
42 | published by the PHP Group. No one other than the PHP Group has
43 | the right to modify the terms applicable to covered code created
44 | under this License.
45 |
46 | 6. Redistributions of any form whatsoever must retain the following
47 | acknowledgment:
48 | "This product includes PHP software, freely available from
49 | ".
50 |
51 | THIS SOFTWARE IS PROVIDED BY THE PHP DEVELOPMENT TEAM ``AS IS'' AND
52 | ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
53 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
54 | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PHP
55 | DEVELOPMENT TEAM OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
56 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
57 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
58 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
59 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
60 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
61 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
62 | OF THE POSSIBILITY OF SUCH DAMAGE.
63 |
64 | --------------------------------------------------------------------
65 |
66 | This software consists of voluntary contributions made by many
67 | individuals on behalf of the PHP Group.
68 |
69 | The PHP Group can be contacted via Email at group@php.net.
70 |
71 | For more information on the PHP Group and the PHP project,
72 | please see .
73 |
74 | PHP includes the Zend Engine, freely available at
75 | .
76 |
--------------------------------------------------------------------------------
/README.rst:
--------------------------------------------------------------------------------
1 | TimezoneDB
2 | ==========
3 |
4 | This extension is a drop-in replacement for the builtin timezone database that
5 | comes with PHP. You should only install this extension in case you need to get
6 | a later version of the timezone database than the one that ships with PHP.
7 |
8 | The data that this extension uses comes from the "Olson" database, which is
9 | located at http://www.iana.org/time-zones.
10 |
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "pecl/timezonedb",
3 | "type": "php-ext",
4 | "license": "PHP-3.01",
5 | "description": "This extension is a drop-in replacement for the builtin timezone database that comes with PHP.",
6 | "require": {
7 | "php": ">=5.4"
8 | },
9 | "php-ext": {
10 | "priority": 20,
11 | "configure-options": []
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/config.m4:
--------------------------------------------------------------------------------
1 | dnl $Id$
2 | dnl config.m4 for input timezonedbing extension
3 |
4 | PHP_ARG_ENABLE(timezonedb, whether to enable timezonedb support,
5 | [ --enable-timezonedb Enable timezonedb support])
6 |
7 | if test "$PHP_timezonedb" != "no"; then
8 | PHP_SUBST(TIMEZONEDB_SHARED_LIBADD)
9 | PHP_NEW_EXTENSION(timezonedb, timezonedb.c, $ext_shared)
10 | CPPFLAGS="$CPPFLAGS -Wall"
11 | INCLUDES="$INCLUDES -I$prefix/include/php/ext/date/lib"
12 | fi
13 |
--------------------------------------------------------------------------------
/config.w32:
--------------------------------------------------------------------------------
1 | // $Id$
2 | // vim:ft=javascript
3 |
4 | ARG_ENABLE("timezonedb", "timezonedb support", "no");
5 |
6 | if (PHP_TIMEZONEDB != "no") {
7 | EXTENSION("timezonedb", "timezonedb.c");
8 | AC_DEFINE("HAVE_TIMEZONEDB", 1, "timezonedb support");
9 | }
10 |
--------------------------------------------------------------------------------
/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 | timezonedb
7 | pecl.php.net
8 | Timezone Database to be used with PHP's date and time functions
9 | This extension is a drop-in replacement for the builtin timezone database that
10 | comes with PHP. You should only install this extension in case you need to get
11 | a later version of the timezone database than the one that ships with PHP.
12 |
13 | The data that this extension uses comes from the "Olson" database, which is
14 | located at http://www.iana.org/time-zones.
15 |
16 |
17 |
18 | Derick Rethans
19 | derick
20 | derick@php.net
21 | yes
22 |
23 | 2025-03-24
24 |
25 |
26 | 2025.2
27 | 2025.2
28 |
29 |
30 | stable
31 | stable
32 |
33 | PHP
34 |
35 | Updated to version 2025.2 (2025b)
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 | 5.4.0
52 |
53 |
54 | 1.4.0b1
55 |
56 |
57 |
58 | timezonedb
59 |
60 |
61 |
--------------------------------------------------------------------------------
/php_timezonedb.h:
--------------------------------------------------------------------------------
1 | /*
2 | +----------------------------------------------------------------------+
3 | | PHP Version 5 |
4 | +----------------------------------------------------------------------+
5 | | Copyright (c) 1997-2005 The PHP Group |
6 | +----------------------------------------------------------------------+
7 | | This source file is subject to version 3.0 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_0.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 |
16 | +----------------------------------------------------------------------+
17 | */
18 |
19 | /* $Id$ */
20 |
21 | #ifndef PHP_TIMEZONEDB_H
22 | #define PHP_TIMEZONEDB_H
23 |
24 | #include "php.h"
25 |
26 | extern zend_module_entry timezonedb_module_entry;
27 | #define phpext_timezonedb_ptr &timezonedb_module_entry
28 |
29 | #define PHP_TIMEZONEDB_VERSION "2025.2"
30 |
31 | PHP_MINIT_FUNCTION(timezonedb);
32 | PHP_MINFO_FUNCTION(timezonedb);
33 |
34 | #endif /* TIMEZONEDB_H */
35 |
36 | /*
37 | * Local variables:
38 | * tab-width: 4
39 | * c-basic-offset: 4
40 | * indent-tabs-mode: t
41 | * End:
42 | */
43 |
--------------------------------------------------------------------------------
/rebuild.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | phpize && ./configure && make clean && make
4 |
--------------------------------------------------------------------------------
/timezonedb.c:
--------------------------------------------------------------------------------
1 | /*
2 | +----------------------------------------------------------------------+
3 | | PHP Version 5 |
4 | +----------------------------------------------------------------------+
5 | | Copyright (c) 1997-2005 The PHP Group |
6 | +----------------------------------------------------------------------+
7 | | This source file is subject to version 3.0 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_0.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 |
16 | +----------------------------------------------------------------------+
17 | */
18 |
19 | /* $Id$ */
20 |
21 | #ifdef HAVE_CONFIG_H
22 | #include "config.h"
23 | #endif
24 |
25 | #include "php.h"
26 | #include "ext/standard/info.h"
27 |
28 | #include "php_timezonedb.h"
29 |
30 | #include "ext/date/php_date.h"
31 |
32 | #define timezonedb_builtin timezonedb_external
33 | #define timezonedb_idx_builtin timezonedb_idx_external
34 | #define timelib_timezone_db_data_builtin timelib_timezone_db_data_external
35 |
36 | #if PHP_VERSION_ID >= 50441 && PHP_VERSION_ID <= 50499
37 | # define TIMELIB_SUPPORTS_V2DATA
38 | #endif
39 | #if PHP_VERSION_ID >= 50525 && PHP_VERSION_ID <= 50599
40 | # define TIMELIB_SUPPORTS_V2DATA
41 | #endif
42 | #if PHP_VERSION_ID >= 50609 && PHP_VERSION_ID <= 50699
43 | # define TIMELIB_SUPPORTS_V2DATA
44 | #endif
45 | #if PHP_VERSION_ID >= 70000
46 | # define TIMELIB_SUPPORTS_V2DATA
47 | #endif
48 |
49 | #include "timezonedb.h"
50 |
51 | /* {{{ timezonedb_functions[]
52 | */
53 | zend_function_entry timezonedb_functions[] = {
54 | {NULL, NULL, NULL}
55 | };
56 | /* }}} */
57 |
58 | /* {{{ timezonedb dependencies */
59 | #if ZEND_MODULE_API_NO >= 20050922
60 | static const zend_module_dep timezonedb_module_deps[] = {
61 | ZEND_MOD_REQUIRED("standard")
62 | ZEND_MOD_REQUIRED("date")
63 | {NULL, NULL, NULL}
64 | };
65 | #endif
66 | /* }}} */
67 | /* {{{ timezonedb_module_entry
68 | */
69 | zend_module_entry timezonedb_module_entry = {
70 | #if ZEND_MODULE_API_NO >= 20050922
71 | STANDARD_MODULE_HEADER_EX, NULL,
72 | timezonedb_module_deps,
73 | #else
74 | STANDARD_MODULE_HEADER,
75 | #endif
76 | "timezonedb",
77 | timezonedb_functions,
78 | PHP_MINIT(timezonedb),
79 | NULL,
80 | NULL,
81 | NULL,
82 | PHP_MINFO(timezonedb),
83 | PHP_TIMEZONEDB_VERSION,
84 | STANDARD_MODULE_PROPERTIES
85 | };
86 | /* }}} */
87 |
88 | #ifdef COMPILE_DL_TIMEZONEDB
89 | ZEND_GET_MODULE(timezonedb)
90 | #endif
91 |
92 | /* {{{ PHP_MINIT_FUNCTION
93 | */
94 | PHP_MINIT_FUNCTION(timezonedb)
95 | {
96 | php_date_set_tzdb(&timezonedb_external);
97 | return SUCCESS;
98 | }
99 | /* }}} */
100 |
101 | /* {{{ PHP_MSHUTDOWN_FUNCTION
102 | */
103 | PHP_MSHUTDOWN_FUNCTION(timezonedb)
104 | {
105 | return SUCCESS;
106 | }
107 | /* }}} */
108 |
109 | /* {{{ PHP_MINFO_FUNCTION
110 | */
111 | PHP_MINFO_FUNCTION(timezonedb)
112 | {
113 | timelib_tzdb *tzdb = &timezonedb_external;
114 |
115 | php_info_print_table_start();
116 | php_info_print_table_row(2, "Alternative Timezone Database", "enabled");
117 | php_info_print_table_row(2, "Timezone Database Version", tzdb->version);
118 | php_info_print_table_end();
119 | }
120 | /* }}} */
121 |
122 | /*
123 | * Local variables:
124 | * tab-width: 4
125 | * c-basic-offset: 4
126 | * End:
127 | * vim600: noet sw=4 ts=4 fdm=marker
128 | * vim<600: noet sw=4 ts=4
129 | */
130 |
--------------------------------------------------------------------------------