mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-14 12:40:50 +00:00
Compare commits
903
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fb33ebf641 | ||
|
|
29cd6eb799 | ||
|
|
b6336b0d3e | ||
|
|
c842e1ac53 | ||
|
|
bc7d4dc523 | ||
|
|
c189845951 | ||
|
|
f70ca770b6 | ||
|
|
5060fc2349 | ||
|
|
b152633ecb | ||
|
|
5cdf37e603 | ||
|
|
88e94a0bd1 | ||
|
|
c3ee17065b | ||
|
|
21dbd2ffcd | ||
|
|
0166e5c466 | ||
|
|
91c7460c53 | ||
|
|
c3be49e07d | ||
|
|
f3c7e1cefb | ||
|
|
1f736085f1 | ||
|
|
d88ef8d7e1 | ||
|
|
8a4702223d | ||
|
|
e8af216ce5 | ||
|
|
dbfa0140ae | ||
|
|
5a3688fe2c | ||
|
|
ba50b27284 | ||
|
|
f5358c0e23 | ||
|
|
da9da5742c | ||
|
|
98422cfa3d | ||
|
|
8a3e2a6b14 | ||
|
|
164167f3da | ||
|
|
e3b2859c8a | ||
|
|
6eb4daabeb | ||
|
|
68c500421c | ||
|
|
19c62e83fa | ||
|
|
7c2031bfca | ||
|
|
fc169d2133 | ||
|
|
d8ccffa79a | ||
|
|
e78e839e53 | ||
|
|
528aa540b4 | ||
|
|
548798818b | ||
|
|
55d92413b9 | ||
|
|
5812f7a8d3 | ||
|
|
628a52d365 | ||
|
|
80191eebec | ||
|
|
cd66aad141 | ||
|
|
c1d98588a2 | ||
|
|
d23d4fd61b | ||
|
|
be0758b75a | ||
|
|
ccba0f5948 | ||
|
|
37b0ad5537 | ||
|
|
cfa885830a | ||
|
|
118db2d2f7 | ||
|
|
5262bd9ea3 | ||
|
|
a308000ff2 | ||
|
|
f10d8c21ab | ||
|
|
a2cd2965d7 | ||
|
|
7ea44da104 | ||
|
|
8be5bb8b10 | ||
|
|
c32e53b641 | ||
|
|
e305e8fb7a | ||
|
|
ddcef0fc0f | ||
|
|
dfadda3d09 | ||
|
|
7bf2947016 | ||
|
|
d4b81223cd | ||
|
|
6336c4f629 | ||
|
|
db4eb54149 | ||
|
|
a3286a8ee4 | ||
|
|
a438a633e9 | ||
|
|
bba09a53f4 | ||
|
|
c6e8c2bc9f | ||
|
|
591e811a35 | ||
|
|
e5179054fb | ||
|
|
f361caa5c0 | ||
|
|
bc410c2609 | ||
|
|
d9de0f8683 | ||
|
|
af6ba57d95 | ||
|
|
26eb6c5bab | ||
|
|
49256dcf6f | ||
|
|
741efa7807 | ||
|
|
230e505fd8 | ||
|
|
1a72d3225c | ||
|
|
63c0ecc445 | ||
|
|
e6aea3dc78 | ||
|
|
2c317bea2c | ||
|
|
83d51baf83 | ||
|
|
123b1d79eb | ||
|
|
cb04599d27 | ||
|
|
6c90612d13 | ||
|
|
59d413ceb8 | ||
|
|
58f90ab569 | ||
|
|
27856f64c3 | ||
|
|
938f256ed9 | ||
|
|
cc96166f74 | ||
|
|
f2367d4626 | ||
|
|
14be7dcf8e | ||
|
|
51ea2cfbe1 | ||
|
|
cbf385e68c | ||
|
|
005205714b | ||
|
|
15a71fe045 | ||
|
|
f936a17c12 | ||
|
|
36b27f2ba5 | ||
|
|
24b1bb0abd | ||
|
|
40f76c9f0c | ||
|
|
211dacd7b5 | ||
|
|
10dc1950f7 | ||
|
|
f0a42d9fe4 | ||
|
|
f6e8ce8121 | ||
|
|
f577a03c04 | ||
|
|
fb1c573a29 | ||
|
|
9eb6f86765 | ||
|
|
1d846fdfb2 | ||
|
|
503df277ab | ||
|
|
98eee90734 | ||
|
|
25d988e91a | ||
|
|
d3146889ab | ||
|
|
502cfddf28 | ||
|
|
e3997b2c82 | ||
|
|
177cdcf313 | ||
|
|
bc59289b7a | ||
|
|
887ae8a380 | ||
|
|
6b637ac589 | ||
|
|
eaeccc1d99 | ||
|
|
ed02dce2a4 | ||
|
|
11a4b57e61 | ||
|
|
7d3c057bd1 | ||
|
|
3c4c9a23bc | ||
|
|
d2047503cb | ||
|
|
25a3ebdc73 | ||
|
|
5e9f7f619e | ||
|
|
578ba71b3b | ||
|
|
777e189445 | ||
|
|
8ad4de887f | ||
|
|
a059244b3c | ||
|
|
b6b0289f5e | ||
|
|
e763a1cdc7 | ||
|
|
c78813a6b8 | ||
|
|
9d59beb8ba | ||
|
|
0fbb9f343f | ||
|
|
58ccfb051b | ||
|
|
298db6fc92 | ||
|
|
9fbf13a496 | ||
|
|
f600785f65 | ||
|
|
92dd3df148 | ||
|
|
9e47f868d3 | ||
|
|
b53fb886a4 | ||
|
|
6125ce9d33 | ||
|
|
ad7ed6fe21 | ||
|
|
787e3a1ee4 | ||
|
|
9839d3a953 | ||
|
|
a8ffc69288 | ||
|
|
98f28a911c | ||
|
|
ffeb8d1b03 | ||
|
|
67b99b698f | ||
|
|
e19bf29b53 | ||
|
|
45ac5edbd9 | ||
|
|
d0d7db8b3f | ||
|
|
53fe84bfcc | ||
|
|
68e27b0763 | ||
|
|
c04617aa61 | ||
|
|
9c79de4d62 | ||
|
|
22c487616f | ||
|
|
ca23b0484c | ||
|
|
7bc31238b4 | ||
|
|
8e3260376c | ||
|
|
4ec299437d | ||
|
|
8ad71bc1d2 | ||
|
|
ab85763997 | ||
|
|
ab8c0f194a | ||
|
|
c05fcc4687 | ||
|
|
0b5825d0e9 | ||
|
|
75d0ba5179 | ||
|
|
fadcfc8149 | ||
|
|
7d06a5c89f | ||
|
|
176c9b61a4 | ||
|
|
9138966c67 | ||
|
|
968c8fc0d5 | ||
|
|
37acebcc8c | ||
|
|
e97b10f1a0 | ||
|
|
4d31ee9043 | ||
|
|
5efbcd1882 | ||
|
|
a7815e63bd | ||
|
|
d37658be6c | ||
|
|
e83e187a9f | ||
|
|
1758525df9 | ||
|
|
9fca585488 | ||
|
|
ece23ea20f | ||
|
|
781521e112 | ||
|
|
a645af4456 | ||
|
|
b4db9e9acc | ||
|
|
734c1f3cd4 | ||
|
|
fb0be397d0 | ||
|
|
12e2fc4ab6 | ||
|
|
9290c826fa | ||
|
|
b07b526b95 | ||
|
|
eca1623f1b | ||
|
|
b2dfcb30eb | ||
|
|
9beb743b07 | ||
|
|
5b497797f2 | ||
|
|
1cb2079d6c | ||
|
|
0e44c980f9 | ||
|
|
8f35685744 | ||
|
|
0a3ea6091c | ||
|
|
9f00e26008 | ||
|
|
c9a14b3aee | ||
|
|
bba881e424 | ||
|
|
a10ef3d5cc | ||
|
|
58dd892156 | ||
|
|
eead6bf97a | ||
|
|
ae5dbea5e7 | ||
|
|
a2c9ba78dd | ||
|
|
25d40602cb | ||
|
|
e33721978e | ||
|
|
f10fd89f99 | ||
|
|
34ed75fab7 | ||
|
|
314bef5d03 | ||
|
|
bb0a15f499 | ||
|
|
e986f71527 | ||
|
|
1d781fbdb1 | ||
|
|
ff1b1c2761 | ||
|
|
73d68ff3e0 | ||
|
|
5ce28090e0 | ||
|
|
44b3bc847b | ||
|
|
839b3d1677 | ||
|
|
f588a02463 | ||
|
|
0b71ae7a15 | ||
|
|
3eb7ea55ae | ||
|
|
88ec44dfe3 | ||
|
|
5d85d967bd | ||
|
|
42ccf41e96 | ||
|
|
858614e92a | ||
|
|
ffa4d48e70 | ||
|
|
f508734e2f | ||
|
|
ede8cee9e6 | ||
|
|
416c993c8e | ||
|
|
6f395736e2 | ||
|
|
f95063647c | ||
|
|
2198d38cbc | ||
|
|
57fc9fcba4 | ||
|
|
3d55910f35 | ||
|
|
e02c41fc72 | ||
|
|
7027a1643f | ||
|
|
fb88cee0fc | ||
|
|
65d4bd0311 | ||
|
|
0f7ddf0d47 | ||
|
|
ae6d877f54 | ||
|
|
2f444640b4 | ||
|
|
7240d99838 | ||
|
|
7775f9e872 | ||
|
|
e2afa00b4c | ||
|
|
26473523b0 | ||
|
|
877e0b04bc | ||
|
|
2a361b14ea | ||
|
|
7751ae59ae | ||
|
|
9071ff5c87 | ||
|
|
4b67943501 | ||
|
|
8eee20d876 | ||
|
|
80c3b078b8 | ||
|
|
cf91d81b31 | ||
|
|
85c243ef66 | ||
|
|
aa143515d6 | ||
|
|
0397b8c5c5 | ||
|
|
bb1814b5c3 | ||
|
|
965daf4349 | ||
|
|
925d969f9e | ||
|
|
4e85dd0346 | ||
|
|
2b76520d86 | ||
|
|
3c2b087b3e | ||
|
|
5f7707cc8a | ||
|
|
5315cea6e2 | ||
|
|
53d8775015 | ||
|
|
d82805f097 | ||
|
|
63a0ddb013 | ||
|
|
b9b06c4bdf | ||
|
|
9891f11f84 | ||
|
|
e53a9aaa4a | ||
|
|
0292456262 | ||
|
|
2f73f2436a | ||
|
|
77ad860bf0 | ||
|
|
d1f43b1a58 | ||
|
|
f955cff54c | ||
|
|
aad4544e95 | ||
|
|
d30477f23a | ||
|
|
c3177f8279 | ||
|
|
7778106f40 | ||
|
|
5d6912d185 | ||
|
|
c33ca443ee | ||
|
|
8bfe748fb0 | ||
|
|
6fab62e923 | ||
|
|
863acd7753 | ||
|
|
08c04c9245 | ||
|
|
200d526a9c | ||
|
|
532aec7af2 | ||
|
|
8e147f12b9 | ||
|
|
a3da46b524 | ||
|
|
547fee9cd4 | ||
|
|
999fe36d40 | ||
|
|
7c556c44a1 | ||
|
|
46d87c1f10 | ||
|
|
5e2751e7ff | ||
|
|
5acb8381b2 | ||
|
|
de5f15ed4e | ||
|
|
fd993b1045 | ||
|
|
fb09021432 | ||
|
|
481a65a028 | ||
|
|
9f5ed133b3 | ||
|
|
b9b2ae703c | ||
|
|
49702ad7fb | ||
|
|
816758eda2 | ||
|
|
abbdbc21b0 | ||
|
|
7045362ce7 | ||
|
|
bf1c1d07db | ||
|
|
397f5cb687 | ||
|
|
21f049b45c | ||
|
|
a52d1088e5 | ||
|
|
e4f7ff9c0f | ||
|
|
e50cc4d3af | ||
|
|
3f8961dfac | ||
|
|
ee36507423 | ||
|
|
f8ff4c4918 | ||
|
|
a55af1e271 | ||
|
|
81473829d4 | ||
|
|
677cd85cb7 | ||
|
|
23e97b0222 | ||
|
|
e7aebcc186 | ||
|
|
f63a0fef6b | ||
|
|
d432bdb4ab | ||
|
|
4d61091ac7 | ||
|
|
747f70ba82 | ||
|
|
08d8623dec | ||
|
|
1f150fcde1 | ||
|
|
d3d23e0cb8 | ||
|
|
787bf7eaf7 | ||
|
|
50bd4996fd | ||
|
|
62098a10aa | ||
|
|
b497b6edf9 | ||
|
|
b65e6cfe35 | ||
|
|
53169dc480 | ||
|
|
2929110ce1 | ||
|
|
6c3c18723c | ||
|
|
6c8a5817ec | ||
|
|
ef25e56ae6 | ||
|
|
1ea657c65e | ||
|
|
c2bfdf3712 | ||
|
|
ad279bd180 | ||
|
|
fcaf183174 | ||
|
|
fee21a45df | ||
|
|
c8eccf8451 | ||
|
|
9c5a1dad64 | ||
|
|
30f121f9bc | ||
|
|
f3cda1a3a5 | ||
|
|
9317e910fe | ||
|
|
d1fc9b425f | ||
|
|
406622d117 | ||
|
|
c8732b1c5f | ||
|
|
51658bac35 | ||
|
|
611d117b24 | ||
|
|
d8881f4eb4 | ||
|
|
f48abfa902 | ||
|
|
a51c542b53 | ||
|
|
dc3b9fe619 | ||
|
|
1db7e4a962 | ||
|
|
ac1fd769ad | ||
|
|
843e492c68 | ||
|
|
ec3ea3081d | ||
|
|
d0146c2506 | ||
|
|
0f55138533 | ||
|
|
ec3d864784 | ||
|
|
0e8ccb179d | ||
|
|
d34c8fa802 | ||
|
|
6b9ccda936 | ||
|
|
74124de048 | ||
|
|
e9426cf816 | ||
|
|
b6e34eaf04 | ||
|
|
c3bb81d5a4 | ||
|
|
c935b832dc | ||
|
|
1195de87ff | ||
|
|
ee50fcfa27 | ||
|
|
2b83f0da89 | ||
|
|
24e595bf26 | ||
|
|
6e39258302 | ||
|
|
d0cda9d0bd | ||
|
|
e995b7e475 | ||
|
|
4c12da6aca | ||
|
|
1322c2c86a | ||
|
|
6d1dd8b0af | ||
|
|
a87434bda8 | ||
|
|
2019b25daa | ||
|
|
7b248a1b32 | ||
|
|
4d69587035 | ||
|
|
ca6d701994 | ||
|
|
d67873ec99 | ||
|
|
a1c0824518 | ||
|
|
9d236d63f9 | ||
|
|
1dc47286d1 | ||
|
|
6de12a5f1e | ||
|
|
40ab4c9d4e | ||
|
|
7fc396c15d | ||
|
|
986a9e879a | ||
|
|
4d1707b764 | ||
|
|
0726d0be9f | ||
|
|
e4917d141a | ||
|
|
72f7d0b184 | ||
|
|
7d53e65125 | ||
|
|
e22094eb13 | ||
|
|
ad120c5ae9 | ||
|
|
519ca1d53b | ||
|
|
c8dea7ae1e | ||
|
|
2606c5f0fe | ||
|
|
03aef5f65c | ||
|
|
fa78afa112 | ||
|
|
ec90310ea9 | ||
|
|
0663ca135d | ||
|
|
9d9873b3b5 | ||
|
|
92ceb64faf | ||
|
|
15efa985df | ||
|
|
4372293192 | ||
|
|
abefb6dfe7 | ||
|
|
7e21f472c6 | ||
|
|
7c8357929c | ||
|
|
8d87f6f6dd | ||
|
|
c3a1cc382a | ||
|
|
d3aa65231e | ||
|
|
9fd33c1f20 | ||
|
|
a93fe32c1a | ||
|
|
b5bc88c64e | ||
|
|
4f1ea03528 | ||
|
|
db9778dfb2 | ||
|
|
d11fceab15 | ||
|
|
4f63024206 | ||
|
|
72c008f945 | ||
|
|
b0d6d27349 | ||
|
|
978c6c4e31 | ||
|
|
1c68d63f35 | ||
|
|
7deb561f75 | ||
|
|
b0950ff854 | ||
|
|
1981c48e60 | ||
|
|
29e673f8ed | ||
|
|
474ee702ab | ||
|
|
af71942da2 | ||
|
|
6d0391b1a4 | ||
|
|
0d6c56a8ea | ||
|
|
2dd77456fe | ||
|
|
a680d701ce | ||
|
|
33b4405d84 | ||
|
|
47d75394c9 | ||
|
|
f64d00d684 | ||
|
|
bffe657d94 | ||
|
|
8cdb9784d2 | ||
|
|
3a4db74ee4 | ||
|
|
296eb5193c | ||
|
|
8466ef9096 | ||
|
|
0217a81722 | ||
|
|
e095e6db63 | ||
|
|
3752d18ffe | ||
|
|
2a33e357cd | ||
|
|
550595c085 | ||
|
|
801cdb8945 | ||
|
|
d526ddec85 | ||
|
|
8c85d7b732 | ||
|
|
ed2a5ebaeb | ||
|
|
ccc0a92504 | ||
|
|
bad5639386 | ||
|
|
634f79d8d8 | ||
|
|
e8c200515a | ||
|
|
b05ff14a9a | ||
|
|
db63367871 | ||
|
|
76b2b4a190 | ||
|
|
628c257f71 | ||
|
|
73d6456d7d | ||
|
|
28391b9e7f | ||
|
|
8a52a61e3a | ||
|
|
95870dcc77 | ||
|
|
96323d1bd7 | ||
|
|
da2f581833 | ||
|
|
7418f6814f | ||
|
|
b71023e297 | ||
|
|
418f97443a | ||
|
|
c7a0177491 | ||
|
|
43152bc39f | ||
|
|
0c0b955d5f | ||
|
|
9a01fe712a | ||
|
|
eedc060c92 | ||
|
|
6544ec5460 | ||
|
|
fd86fdd7b8 | ||
|
|
ee84f34344 | ||
|
|
3cd5f28899 | ||
|
|
5ef10d08ec | ||
|
|
7d5c0f1906 | ||
|
|
cfc6c4d297 | ||
|
|
084e34098a | ||
|
|
d8f1afb45e | ||
|
|
5c59dd0047 | ||
|
|
9641586efa | ||
|
|
41e5f916bf | ||
|
|
de2f28ede1 | ||
|
|
e3e3d37fa9 | ||
|
|
7670590efd | ||
|
|
9551818649 | ||
|
|
351f98f5f3 | ||
|
|
7910c1dee9 | ||
|
|
b5052f0110 | ||
|
|
46e0c474e0 | ||
|
|
66c7c28dbf | ||
|
|
fba792945e | ||
|
|
b134793b32 | ||
|
|
3d93856c4a | ||
|
|
d99cd28925 | ||
|
|
168ec3a6e1 | ||
|
|
a84608d4e2 | ||
|
|
c24b3eff11 | ||
|
|
d7a10f0e32 | ||
|
|
10a7f2cf62 | ||
|
|
40d15cb03d | ||
|
|
5f1d553e7e | ||
|
|
83d8ebc991 | ||
|
|
c2cf132ecd | ||
|
|
253d49369d | ||
|
|
2874fa8fb0 | ||
|
|
73430d5362 | ||
|
|
7452fd0263 | ||
|
|
99b1a62d55 | ||
|
|
0d37dcd21d | ||
|
|
2272f408ed | ||
|
|
689f9956da | ||
|
|
fcad6a97b8 | ||
|
|
7674b5e574 | ||
|
|
7c5e454b09 | ||
|
|
7f01872a24 | ||
|
|
ea2507bc24 | ||
|
|
42e15813e2 | ||
|
|
35deb4c88b | ||
|
|
8ed0094f48 | ||
|
|
1454dc20eb | ||
|
|
ac6eefcf3d | ||
|
|
3719aaebbf | ||
|
|
3d1cb7e32c | ||
|
|
a54079b92f | ||
|
|
05c65de082 | ||
|
|
b09497c0e2 | ||
|
|
3a61773b45 | ||
|
|
0cb5a2cb49 | ||
|
|
5cf215536b | ||
|
|
be57071e8c | ||
|
|
ea21b60dda | ||
|
|
c347f49a2d | ||
|
|
f5d478c8e6 | ||
|
|
b5c9cd4df6 | ||
|
|
194547f591 | ||
|
|
f87e513557 | ||
|
|
7015d22116 | ||
|
|
3e11b7fc21 | ||
|
|
c3b0e68eb7 | ||
|
|
afd59b0c80 | ||
|
|
a8427e7d37 | ||
|
|
58aa726548 | ||
|
|
77f3cef35c | ||
|
|
87a91aef83 | ||
|
|
9aa6898b9b | ||
|
|
613bac9eb3 | ||
|
|
d95221ec4b | ||
|
|
dcae6d6423 | ||
|
|
88c7556d99 | ||
|
|
d103802003 | ||
|
|
2d60b35147 | ||
|
|
75cb69740e | ||
|
|
04a6bbae6c | ||
|
|
8a9ff55397 | ||
|
|
a77eddff96 | ||
|
|
cab41ecb93 | ||
|
|
45613b3473 | ||
|
|
b5d7663444 | ||
|
|
3549d9184a | ||
|
|
2f5129cacb | ||
|
|
d33194d2aa | ||
|
|
a6bbb534d5 | ||
|
|
9ca0cd0a1a | ||
|
|
5f9ae45e22 | ||
|
|
cbb72a2f8e | ||
|
|
c40c0b8111 | ||
|
|
8cb0627325 | ||
|
|
82d4727dbb | ||
|
|
822c13b9ef | ||
|
|
6b2813c3a7 | ||
|
|
674fe0af38 | ||
|
|
b394343a31 | ||
|
|
4b746fce1c | ||
|
|
20fe838c76 | ||
|
|
6602cc0385 | ||
|
|
3fd08a1595 | ||
|
|
21eab49a53 | ||
|
|
afa39038c2 | ||
|
|
44eec946e8 | ||
|
|
55562dfb00 | ||
|
|
361d3007a6 | ||
|
|
a1573d5620 | ||
|
|
0413feb29c | ||
|
|
ff04db4420 | ||
|
|
9369843ee2 | ||
|
|
f18cf46d07 | ||
|
|
b786e1b45c | ||
|
|
fd07302024 | ||
|
|
e67379399a | ||
|
|
251a5599b4 | ||
|
|
d01453b129 | ||
|
|
0f88a49fd5 | ||
|
|
b2919853f8 | ||
|
|
5ce744091c | ||
|
|
d724d8c107 | ||
|
|
dea41f3c3a | ||
|
|
d78a7909c8 | ||
|
|
0b69ce72b8 | ||
|
|
42549b7844 | ||
|
|
dc00b6cf3f | ||
|
|
056df0dcb2 | ||
|
|
a8862d215c | ||
|
|
f1fd11f4ca | ||
|
|
9fbd8620fb | ||
|
|
e866e05b0d | ||
|
|
cd9d90f4d4 | ||
|
|
7378967206 | ||
|
|
81ad6a978a | ||
|
|
e967de6bfa | ||
|
|
c0383b5039 | ||
|
|
b2824629c2 | ||
|
|
c2e3541cc1 | ||
|
|
b689857d53 | ||
|
|
384da65a97 | ||
|
|
b5935c339e | ||
|
|
6355e650f7 | ||
|
|
a1bf36778a | ||
|
|
ea734e2ac2 | ||
|
|
97b3cce755 | ||
|
|
eb21300a26 | ||
|
|
5bbd459609 | ||
|
|
b971087354 | ||
|
|
db5b8dbcdf | ||
|
|
ebb00c1e0f | ||
|
|
4f1c2c22ca | ||
|
|
ecc8f3cf16 | ||
|
|
296d0826da | ||
|
|
24da62d342 | ||
|
|
b4dc3de5ab | ||
|
|
afad9006c7 | ||
|
|
e20a6b0213 | ||
|
|
a6456f0a6c | ||
|
|
fb597a8123 | ||
|
|
8191b9790b | ||
|
|
db78eff4c9 | ||
|
|
a86df6bcb0 | ||
|
|
01171db15d | ||
|
|
965570541b | ||
|
|
6ec494016b | ||
|
|
e7c1c86ceb | ||
|
|
1f977d2377 | ||
|
|
2e77f5eed3 | ||
|
|
7ebf2902e7 | ||
|
|
020d3decb3 | ||
|
|
4e9c3e9396 | ||
|
|
1248e0f7f5 | ||
|
|
bcf50b7261 | ||
|
|
3239f6d679 | ||
|
|
1f843a8fb5 | ||
|
|
58df6a3b61 | ||
|
|
752fc86f2b | ||
|
|
04c87ea815 | ||
|
|
b1a7885dd7 | ||
|
|
6383c6e3d0 | ||
|
|
045d18d246 | ||
|
|
4f64716f37 | ||
|
|
56a999885a | ||
|
|
c22cda5999 | ||
|
|
ae364546d6 | ||
|
|
0966f9de41 | ||
|
|
1aeafb7d4a | ||
|
|
a9ff4d1f5a | ||
|
|
499f5480f1 | ||
|
|
cc577749a8 | ||
|
|
3a2ad5b2c5 | ||
|
|
24c0a17d78 | ||
|
|
3ef8964997 | ||
|
|
52e854f0ab | ||
|
|
be9edd83c2 | ||
|
|
df7f2a5df3 | ||
|
|
b8c6ce91b2 | ||
|
|
bd823a076c | ||
|
|
3641ba4332 | ||
|
|
55db2c31cd | ||
|
|
a454e38b7c | ||
|
|
99ca99f079 | ||
|
|
48907e57ff | ||
|
|
3691f36913 | ||
|
|
5cd348c1d6 | ||
|
|
cf6f25bd37 | ||
|
|
a966d21aa8 | ||
|
|
271f0c4f90 | ||
|
|
03361e9aa5 | ||
|
|
c449057808 | ||
|
|
b7e96f8e0e | ||
|
|
f4792750a5 | ||
|
|
3fff74aab5 | ||
|
|
708349eeac | ||
|
|
d128fdc2dc | ||
|
|
1b8a71e740 | ||
|
|
441487cd05 | ||
|
|
4bf1a11c07 | ||
|
|
079bc324cd | ||
|
|
5b4b19981c | ||
|
|
ccab684d9f | ||
|
|
ee26c1efbc | ||
|
|
799b52e87f | ||
|
|
ccb09d2c12 | ||
|
|
158b06cffb | ||
|
|
61538ebadc | ||
|
|
e8f552aeba | ||
|
|
0591fe2494 | ||
|
|
2e002eaf70 | ||
|
|
4b6345a3ae | ||
|
|
ea0df07398 | ||
|
|
9b327ff15f | ||
|
|
11d3a7869c | ||
|
|
95ef8e96d2 | ||
|
|
3cad07b84f | ||
|
|
00b97d34c1 | ||
|
|
97ed208cfd | ||
|
|
71b12940d0 | ||
|
|
f2ed8c1087 | ||
|
|
5ef63b6f0e | ||
|
|
ba59b6f11b | ||
|
|
07e8cb4205 | ||
|
|
f1c664d379 | ||
|
|
59558ffd96 | ||
|
|
debbaba93f | ||
|
|
ef96411f60 | ||
|
|
de0b816b49 | ||
|
|
acf09c416b | ||
|
|
b28912b0f7 | ||
|
|
a7594cb74f | ||
|
|
ef90e37bd1 | ||
|
|
6c3c88074c | ||
|
|
4494ad6911 | ||
|
|
065551bc9c | ||
|
|
642983c59a | ||
|
|
264271f69e | ||
|
|
e7f4e67155 | ||
|
|
90a2e7c014 | ||
|
|
3866c1699e | ||
|
|
30fb70dd25 | ||
|
|
d53d793673 | ||
|
|
5b02d10584 | ||
|
|
4e03ebc04a | ||
|
|
7121b8d0a2 | ||
|
|
43c78b2422 | ||
|
|
6f2bc07182 | ||
|
|
547f9fd389 | ||
|
|
60a6feed07 | ||
|
|
8af70958fc | ||
|
|
21493e0824 | ||
|
|
9a72a7c58f | ||
|
|
5d2c303438 | ||
|
|
e92a4891aa | ||
|
|
4dc8f4f9d1 | ||
|
|
7829f9b1d2 | ||
|
|
db2807e4d2 | ||
|
|
05e75d6aaa | ||
|
|
44209573e3 | ||
|
|
01735f4d9f | ||
|
|
decf4c6880 | ||
|
|
336cfd9980 | ||
|
|
3df753c6ca | ||
|
|
a063d55395 | ||
|
|
584db6f38f | ||
|
|
bdd56f3107 | ||
|
|
b096eacdd1 | ||
|
|
389ea45b12 | ||
|
|
3bc1226804 | ||
|
|
1cbe4e009c | ||
|
|
0f3e01f5cc | ||
|
|
3e66ae67a8 | ||
|
|
6c1c49d1b5 | ||
|
|
6e3356837d | ||
|
|
49501f8f41 | ||
|
|
3af6201224 | ||
|
|
6b77792dc2 | ||
|
|
05de40a651 | ||
|
|
6275825c68 | ||
|
|
4f8e703854 | ||
|
|
d8c80af71e | ||
|
|
9ec0a2071c | ||
|
|
e112d71435 | ||
|
|
2def85688d | ||
|
|
259477826c | ||
|
|
5dc847c53d | ||
|
|
1f3b87dc11 | ||
|
|
ab07265573 | ||
|
|
707b2a529e | ||
|
|
bd0b0cc8c9 | ||
|
|
71fd58652f | ||
|
|
df5104bfc9 | ||
|
|
112afb9250 | ||
|
|
2492add033 | ||
|
|
73d84d4bbd | ||
|
|
18f567a3b4 | ||
|
|
a80e462fbd | ||
|
|
cd6893aed1 | ||
|
|
d6406bbf5f | ||
|
|
2fab62271a | ||
|
|
6445b3a68f | ||
|
|
1135161b4f | ||
|
|
4d936c1254 | ||
|
|
f555224743 | ||
|
|
0a2a136111 | ||
|
|
3069ad8dd1 | ||
|
|
36eddfc785 | ||
|
|
207105b1a3 | ||
|
|
f64be0b013 | ||
|
|
bbf39c550f | ||
|
|
de5a5f6fdc | ||
|
|
472b25921e | ||
|
|
b202587e09 | ||
|
|
a871badf2a | ||
|
|
4fb7665c09 | ||
|
|
1a23ebc1ff | ||
|
|
f877b86604 | ||
|
|
e88ab74886 | ||
|
|
b59718bdc4 | ||
|
|
aecf996510 | ||
|
|
e53dd027c5 | ||
|
|
f5b4cb7130 | ||
|
|
4375a6c5cd | ||
|
|
f7cf839213 | ||
|
|
e7dd9c781b | ||
|
|
46ecda76ba | ||
|
|
307acb6618 | ||
|
|
b06f8cb58b | ||
|
|
823ca5c697 | ||
|
|
42608a3401 | ||
|
|
afb20f4895 | ||
|
|
e62db6309c | ||
|
|
315d3910fa | ||
|
|
075986f214 | ||
|
|
ef0bd7b215 | ||
|
|
03314e3f69 | ||
|
|
596a892c5e | ||
|
|
a0d1e0915c | ||
|
|
631fc3c9c1 | ||
|
|
3140d40421 | ||
|
|
abd97b8bcb | ||
|
|
86aa1ca990 | ||
|
|
618dcd6520 | ||
|
|
f589e5c791 | ||
|
|
dcd669b4d9 | ||
|
|
9ebf813ea4 | ||
|
|
4c9fe5a490 | ||
|
|
d36344e888 | ||
|
|
da966a93ac | ||
|
|
d058e30917 | ||
|
|
41d7621f48 | ||
|
|
6b73b2d6eb | ||
|
|
aa0e402acf | ||
|
|
17bb8d575a | ||
|
|
bf1c242cf4 | ||
|
|
aee20e637a | ||
|
|
159e5c1048 | ||
|
|
353f7bf461 | ||
|
|
e53162a32b | ||
|
|
41e9ba6333 | ||
|
|
fb9bf5b64b | ||
|
|
a8a9e93e9a | ||
|
|
355743600d | ||
|
|
21c6ba3412 | ||
|
|
9689796c10 | ||
|
|
93c2c56a1b | ||
|
|
39f0e810c9 | ||
|
|
fbc8596b68 | ||
|
|
54e2224df7 | ||
|
|
3e5b8c1e89 | ||
|
|
9ba2cfd33e | ||
|
|
29e4d4eee6 | ||
|
|
aa925cb0ad | ||
|
|
4988e83fe9 | ||
|
|
c2b8066efb | ||
|
|
042ff13ca9 | ||
|
|
9871555090 | ||
|
|
9ca1b2a775 | ||
|
|
91240073ea | ||
|
|
63607375f5 | ||
|
|
2cc1cbf2f4 | ||
|
|
15abb2b56e | ||
|
|
e78712791d | ||
|
|
5097e2ee13 | ||
|
|
b4bce59fe9 | ||
|
|
1fdc518971 | ||
|
|
b112d09013 | ||
|
|
afdf7519d1 | ||
|
|
5e5895a464 | ||
|
|
5f030924c1 | ||
|
|
666cb6c802 | ||
|
|
6202c821a9 | ||
|
|
9c6262f39b | ||
|
|
b2934d2612 | ||
|
|
43e7656241 | ||
|
|
6278f6140f | ||
|
|
1b05a2373b | ||
|
|
fe107cce45 |
No files matched your search
+1
-2
@@ -18,13 +18,12 @@ clone_depth: 64
|
||||
|
||||
cache:
|
||||
- c:\build-cache
|
||||
- c:\build-cache\sdk -> .appveyor.yml
|
||||
|
||||
environment:
|
||||
PHP_BUILD_CACHE_BASE_DIR: c:\build-cache
|
||||
PHP_BUILD_OBJ_DIR: c:\obj
|
||||
PHP_BUILD_CACHE_SDK_DIR: c:\build-cache\sdk
|
||||
PHP_BUILD_SDK_BRANCH: php-sdk-2.0.9
|
||||
PHP_BUILD_SDK_BRANCH: php-sdk-2.0.12
|
||||
PHP_BUILD_CRT: vc15
|
||||
# ext and env setup for tests
|
||||
#MYSQL_TEST_PASSWD: Password12!
|
||||
|
||||
+25
-6
@@ -1,16 +1,35 @@
|
||||
; http://editorconfig.org/
|
||||
# http://editorconfig.org/
|
||||
|
||||
root = true
|
||||
|
||||
[*.{c,h}]
|
||||
charset = UTF-8
|
||||
end_of_line = LF
|
||||
[*.{c,h,awk,w32,bat,mk,frag}]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
indent_size = 4
|
||||
indent_style = tab
|
||||
insert_final_newline = true
|
||||
tab_width = 4
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[*.yml]
|
||||
[*.{php,phpt}]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
indent_size = 4
|
||||
indent_style = space
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[*.{yml,m4,sh}]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
indent_size = 2
|
||||
indent_style = space
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[*.md]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
indent_style = space
|
||||
trim_trailing_whitespace = false
|
||||
insert_final_newline = true
|
||||
@@ -15,11 +15,8 @@ ext/dba/libflatfile/flatfile.c ident
|
||||
ext/dba/libcdb/cdb_make.c ident
|
||||
ext/dba/libcdb/cdb.c ident
|
||||
ext/filter/filter.c ident
|
||||
ext/zip/php_zip.c ident
|
||||
README.input_filter ident
|
||||
run-tests.php ident
|
||||
sapi/nsapi/nsapi.c ident
|
||||
sapi/continuity/capi.c ident
|
||||
Zend/RFCs/002.txt ident
|
||||
Zend/RFCs/003.txt ident
|
||||
ext/exif/exif.c ident
|
||||
@@ -32,7 +29,6 @@ UPGRADING.INTERNALS merge=NEWS
|
||||
/ext/bz2/tests/with_strings.phpt -crlf
|
||||
/ext/dom/tests/bug40836.phpt -crlf
|
||||
/ext/dom/tests/domelement.phpt -crlf
|
||||
/ext/ereg/tests/eregi_basic_002.phpt -crlf
|
||||
/ext/iconv/tests/iconv004.phpt -crlf
|
||||
/ext/iconv/tests/iconv_basic.phpt -crlf
|
||||
/ext/iconv/tests/iconv_strpos.phpt -crlf
|
||||
|
||||
@@ -179,9 +179,7 @@ pear/phpize
|
||||
pear/run-tests
|
||||
pear/php-config
|
||||
pear/scripts
|
||||
sapi/apache/libphp7.module
|
||||
sapi/apache2handler/libphp7.module
|
||||
sapi/apache_hooks/libphp7.module
|
||||
sapi/cgi/php-cgi
|
||||
sapi/cgi/php-cgi.1
|
||||
sapi/cli/php.1
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
dist: trusty
|
||||
language: c
|
||||
sudo: false
|
||||
addons:
|
||||
|
||||
+17
-17
@@ -37,7 +37,7 @@ MAINTENANCE: Unknown
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: cli
|
||||
MAINTENANCE: Marcus Boerger <helly@php.net>, Edin Kadribasic <edink@php.net>
|
||||
MAINTENANCE: Marcus Börger <helly@php.net>, Edin Kadribasic <edink@php.net>
|
||||
STATUS: Working
|
||||
SINCE: 4.3.0
|
||||
-------------------------------------------------------------------------------
|
||||
@@ -68,7 +68,7 @@ STATUS: 5.6
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: dba
|
||||
PRIMARY MAINTAINER: Marcus Börger <helly@php.net>,Christopher Jones <sixd@php.net>, Pierre-Alain Joye <pajoye@php.net>
|
||||
PRIMARY MAINTAINER: Marcus Börger <helly@php.net>,Christopher Jones <sixd@php.net>, Pierre-Alain Joye <pajoye@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
COMMENT: DBM abstraction for db2, db3, db4, dbm, ndbm, gdbm, ini
|
||||
@@ -79,13 +79,13 @@ MAINTENANCE: Odd fixes
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: mysqli
|
||||
PRIMARY MAINTAINER: Georg Richter <georg@php.net>, Andrey Hristov <andrey@php.net>, Johannes Schlüter <johannes@php.net>, Ulf Wendel <uw@php.net>
|
||||
PRIMARY MAINTAINER: Georg Richter <georg@php.net>, Andrey Hristov <andrey@php.net>, Johannes Schlüter <johannes@php.net>, Ulf Wendel <uw@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
SINCE: 5.0
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: mysqlnd
|
||||
PRIMARY MAINTAINER: Andrey Hristov <andrey@php.net>, Johannes Schlüter <johannes@php.net>, Ulf Wendel <uw@php.net>
|
||||
PRIMARY MAINTAINER: Andrey Hristov <andrey@php.net>, Johannes Schlüter <johannes@php.net>, Ulf Wendel <uw@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
SINCE: 5.3
|
||||
@@ -99,7 +99,7 @@ EXTENSION: odbc
|
||||
PRIMARY MAINTAINER: Daniel R. Kalowsky <kalowsky@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
COMMENT: Working
|
||||
COMMENT: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: pdo
|
||||
PRIMARY MAINTAINER: Ilia Alshanetsky <iliaa@php.net>, Wez Furlong <wez@php.net>
|
||||
@@ -120,7 +120,7 @@ STATUS: Working
|
||||
SINCE: 5.1
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: pdo_mysql
|
||||
PRIMARY MAINTAINER: Ilia Alshanetsky <iliaa@php.net>, Johannes Schlüter <johannes@php.net>, Andrey Hristov <andrey@php.net>, Ulf Wendel <uw@php.net>
|
||||
PRIMARY MAINTAINER: Ilia Alshanetsky <iliaa@php.net>, Johannes Schlüter <johannes@php.net>, Andrey Hristov <andrey@php.net>, Ulf Wendel <uw@php.net>
|
||||
MAINTENANCE: Odd fixes
|
||||
STATUS: Working
|
||||
SINCE: 5.1
|
||||
@@ -150,7 +150,7 @@ STATUS: Working
|
||||
SINCE: 5.1
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: pgsql
|
||||
PRIMARY MAINTAINER: Marcus Boerger <helly@php.net>, Yasuo Ohgaki <yohgaki@php.net>
|
||||
PRIMARY MAINTAINER: Marcus Börger <helly@php.net>, Yasuo Ohgaki <yohgaki@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
COMMENT: Use PostgreSQL 7.0.x or later. PostgreSQL 6.5.3 or less have fatal bug.
|
||||
@@ -168,13 +168,13 @@ COMMENT: Integrates SQLite 3 embeddable SQL database engine.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: dom
|
||||
PRIMARY MAINTAINER: Christian Stocker <chregu@php.net>, Rob Richards <rrichards@php.net>, Marcus Boerger <helly@php.net>
|
||||
PRIMARY MAINTAINER: Christian Stocker <chregu@php.net>, Rob Richards <rrichards@php.net>, Marcus Börger <helly@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
SINCE: 5.0
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: simplexml
|
||||
PRIMARY MAINTAINER: Marcus Boerger <helly@php.net>
|
||||
PRIMARY MAINTAINER: Marcus Börger <helly@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
SINCE: 5.0
|
||||
@@ -195,12 +195,12 @@ MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: libxml
|
||||
PRIMARY MAINTAINER: Rob Richards <rrichards@php.net>, Christian Stocker <chregu@php.net>
|
||||
PRIMARY MAINTAINER: Rob Richards <rrichards@php.net>, Christian Stocker <chregu@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: xmlreader
|
||||
PRIMARY MAINTAINER: Rob Richards <rrichards@php.net>, Christian Stocker <chregu@php.net>
|
||||
PRIMARY MAINTAINER: Rob Richards <rrichards@php.net>, Christian Stocker <chregu@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
@@ -335,7 +335,7 @@ STATUS: Working
|
||||
SINCE: 5.2
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: ldap
|
||||
PRIMARY MAINTAINER: Stig Venaas <venaas@php.net>, Douglas Goldstein <cardoe@php.net>, Pierre-Alain Joye <pajoye@php.net>, Côme Bernigaud <mcmic@php.net>
|
||||
PRIMARY MAINTAINER: Stig Venaas <venaas@php.net>, Douglas Goldstein <cardoe@php.net>, Pierre-Alain Joye <pajoye@php.net>, Côme Bernigaud <mcmic@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
@@ -367,13 +367,13 @@ MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: phar
|
||||
PRIMARY MAINTAINER: Greg Beaver <cellog@php.net>, Marcus Börger <helly@php.net>, Steph Fox <sfox@php.net>
|
||||
PRIMARY MAINTAINER: Greg Beaver <cellog@php.net>, Marcus Börger <helly@php.net>, Steph Fox <sfox@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
SINCE: 5.3
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: posix
|
||||
PRIMARY MAINTAINER: Kristian Köhntopp <kris@koehntopp.de>
|
||||
PRIMARY MAINTAINER: Kristian Köhntopp <kris@koehntopp.de>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
@@ -388,12 +388,12 @@ MAINTENANCE: Unknown
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: recode
|
||||
PRIMARY MAINTAINER: Kristian Köhntopp <kris@koehntopp.de>
|
||||
PRIMARY MAINTAINER: Kristian Köhntopp <kris@koehntopp.de>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: reflection
|
||||
PRIMARY MAINTAINER: Marcus Börger <helly@php.net>, Johannes Schlüter <johannes@php.net>
|
||||
PRIMARY MAINTAINER: Marcus Börger <helly@php.net>, Johannes Schlüter <johannes@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
@@ -426,7 +426,7 @@ STATUS: Working
|
||||
SINCE: 7.2.0
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: spl
|
||||
PRIMARY MAINTAINER: Marcus Boerger <helly@php.net>, Etienne Kneuss <colder@php.net>
|
||||
PRIMARY MAINTAINER: Marcus Börger <helly@php.net>, Etienne Kneuss <colder@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
SINCE: 5.0.0
|
||||
|
||||
+4
-4
@@ -5,7 +5,7 @@ INSTALL_DATA = $(INSTALL) -m 644
|
||||
DEFS = -DPHP_ATOM_INC -I$(top_builddir)/include -I$(top_builddir)/main -I$(top_srcdir)
|
||||
COMMON_FLAGS = $(DEFS) $(INCLUDES) $(EXTRA_INCLUDES) $(CPPFLAGS) $(PHP_FRAMEWORKPATH)
|
||||
|
||||
all: $(all_targets)
|
||||
all: $(all_targets)
|
||||
@echo
|
||||
@echo "Build complete."
|
||||
@echo "Don't forget to run 'make test'."
|
||||
@@ -112,13 +112,13 @@ test: all
|
||||
clean:
|
||||
find . -name \*.gcno -o -name \*.gcda | xargs rm -f
|
||||
find . -name \*.lo -o -name \*.o | xargs rm -f
|
||||
find . -name \*.la -o -name \*.a | xargs rm -f
|
||||
find . -name \*.la -o -name \*.a | xargs rm -f
|
||||
find . -name \*.so | xargs rm -f
|
||||
find . -name .libs -a -type d|xargs rm -rf
|
||||
rm -f libphp$(PHP_MAJOR_VERSION).la $(SAPI_CLI_PATH) $(SAPI_CGI_PATH) $(SAPI_MILTER_PATH) $(SAPI_LITESPEED_PATH) $(SAPI_FPM_PATH) $(OVERALL_TARGET) modules/* libs/*
|
||||
|
||||
distclean: clean
|
||||
rm -f Makefile config.cache config.log config.status Makefile.objects Makefile.fragments libtool main/php_config.h main/internal_functions_cli.c main/internal_functions.c stamp-h sapi/apache/libphp$(PHP_MAJOR_VERSION).module sapi/apache_hooks/libphp$(PHP_MAJOR_VERSION).module buildmk.stamp Zend/zend_dtrace_gen.h Zend/zend_dtrace_gen.h.bak Zend/zend_config.h TSRM/tsrm_config.h
|
||||
rm -f Makefile config.cache config.log config.status Makefile.objects Makefile.fragments libtool main/php_config.h main/internal_functions_cli.c main/internal_functions.c stamp-h buildmk.stamp Zend/zend_dtrace_gen.h Zend/zend_dtrace_gen.h.bak Zend/zend_config.h TSRM/tsrm_config.h
|
||||
rm -f php7.spec main/build-defs.h scripts/phpize
|
||||
rm -f ext/date/lib/timelib_config.h ext/mbstring/oniguruma/config.h ext/mbstring/libmbfl/config.h ext/oci8/oci8_dtrace_gen.h ext/oci8/oci8_dtrace_gen.h.bak
|
||||
rm -f scripts/man1/phpize.1 scripts/php-config scripts/man1/php-config.1 sapi/cli/php.1 sapi/cgi/php-cgi.1 ext/phar/phar.1 ext/phar/phar.phar.1
|
||||
@@ -135,7 +135,7 @@ prof-gen:
|
||||
|
||||
prof-clean:
|
||||
find . -name \*.lo -o -name \*.o | xargs rm -f
|
||||
find . -name \*.la -o -name \*.a | xargs rm -f
|
||||
find . -name \*.la -o -name \*.a | xargs rm -f
|
||||
find . -name \*.so | xargs rm -f
|
||||
rm -f libphp$(PHP_MAJOR_VERSION).la $(SAPI_CLI_PATH) $(SAPI_CGI_PATH) $(SAPI_MILTER_PATH) $(SAPI_LITESPEED_PATH) $(SAPI_FPM_PATH) $(OVERALL_TARGET) modules/* libs/*
|
||||
|
||||
|
||||
@@ -1,12 +1,287 @@
|
||||
PHP NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
?? ??? 2017, PHP 7.2.0beta2
|
||||
09 Nov 2017, PHP 7.2.0RC6
|
||||
|
||||
- Core:
|
||||
. Fixed bug #75420 (Crash when modifing property name in __isset for
|
||||
BP_VAR_IS). (Laruence)
|
||||
|
||||
- GD:
|
||||
. Fixed bug #75437 (Wrong reflection on imagewebp). (Fabien Villepinte)
|
||||
|
||||
- interbase:
|
||||
. Fixed bug #75453 (Incorrect reflection for ibase_[p]connect). (villfa)
|
||||
|
||||
- Mysqli:
|
||||
. Fixed bug #75434 (Wrong reflection for mysqli_fetch_all function). (Fabien
|
||||
Villepinte)
|
||||
|
||||
- SOAP:
|
||||
. Fixed bug #75464 (Wrong reflection on SoapClient::__setSoapHeaders). (villfa)
|
||||
|
||||
26 Oct 2017, PHP 7.2.0RC5
|
||||
|
||||
- Core:
|
||||
. Fixed bug #75368 (mmap/munmap trashing on unlucky allocations). (Nikita,
|
||||
Dmitry)
|
||||
|
||||
- CLI:
|
||||
. Fixed bug #75287 (Builtin webserver crash after chdir in a shutdown
|
||||
function). (Laruence)
|
||||
|
||||
- Date:
|
||||
. Fixed bug #75055 (Out-Of-Bounds Read in timelib_meridian()). (Derick)
|
||||
|
||||
- Enchant:
|
||||
. Fixed bug #53070 (enchant_broker_get_path crashes if no path is set). (jelle
|
||||
van der Waa, cmb)
|
||||
. Fixed bug #75365 (Enchant still reports version 1.1.0). (cmb)
|
||||
|
||||
- Exif:
|
||||
. Fixed bug #75301 (Exif extension has built in revision version). (Peter
|
||||
Kokot)
|
||||
|
||||
- Fileinfo:
|
||||
. Upgrade bundled libmagic to 5.31. (Anatol)
|
||||
|
||||
- GD:
|
||||
. Fixed bug #65148 (imagerotate may alter image dimensions). (cmb)
|
||||
|
||||
- Intl:
|
||||
. Fixed bug #75378 ([REGRESSION] IntlDateFormatter::parse() does not change
|
||||
$position argument). (Laruence)
|
||||
. Fixed bug #75317 (UConverter::setDestinationEncoding changes source instead
|
||||
of destination). (andrewnester)
|
||||
|
||||
- JSON:
|
||||
. Fixed bug #68567 (JSON_PARTIAL_OUTPUT_ON_ERROR can result in JSON with null
|
||||
key). (Jakub Zelenka)
|
||||
|
||||
- OCI8:
|
||||
. Fixed valgrind issue. (Tianfang Yang)
|
||||
|
||||
- Opcache:
|
||||
. Fixed bug (assertion fails with extended info generated). (Laruence)
|
||||
. Fixed bug (Phi sources removel). (Laruence)
|
||||
. Fixed bug #75370 (Webserver hangs on valid PHP text). (Laruence)
|
||||
. Fixed bug #75357 (segfault loading WordPress wp-admin). (Laruence)
|
||||
. Fixed bug #75373 (Warning Internal error: wrong size calculation). (Laruence, Dmitry)
|
||||
|
||||
- Openssl:
|
||||
. Fixed bug #75363 (openssl_x509_parse leaks memory). (Bob)
|
||||
. Fixed bug #75307 (Wrong reflection for openssl_open function). (villfa)
|
||||
|
||||
- PCRE:
|
||||
. Fixed bug #75207 (applied upstream patch for CVE-2016-1283). (Anatol)
|
||||
|
||||
- PGSQL:
|
||||
. Fixed bug #75419 (Default link incorrectly cleared/linked by pg_close()). (Sara)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #75221 (Argon2i always throws NUL at the end). (cmb)
|
||||
|
||||
- Zlib:
|
||||
. Fixed bug #75299 (Wrong reflection on inflate_init and inflate_add). (Fabien
|
||||
Villepinte)
|
||||
|
||||
12 Oct 2017, PHP 7.2.0RC4
|
||||
|
||||
- Core
|
||||
. Fixed bug #75220 (Segfault when calling is_callable on parent).
|
||||
(andrewnester)
|
||||
. Fixed bug #75290 (debug info of Closures of internal functions contain
|
||||
garbage argument names). (Andrea)
|
||||
|
||||
- Apache2Handler:
|
||||
. Fixed bug #75311 (error: 'zend_hash_key' has no member named 'arKey' in
|
||||
apache2handler). (mcarbonneaux)
|
||||
|
||||
- Date:
|
||||
. Fixed bug #75222 (DateInterval microseconds property always 0). (jhdxr)
|
||||
|
||||
- Hash:
|
||||
. Fixed Bug #75284 (sha3 is not supported on bigendian machine). (Remi)
|
||||
|
||||
- Intl:
|
||||
. Fixed bug #75318 (The parameter of UConverter::getAliases() is not
|
||||
optional). (cmb)
|
||||
|
||||
- litespeed:
|
||||
. Fixed bug #75248 (Binary directory doesn't get created when building
|
||||
only litespeed SAPI). (petk)
|
||||
. Fixed bug #75251 (Missing program prefix and suffix). (petk)
|
||||
|
||||
- OCI8:
|
||||
. Fixed incorrect reference counting. (Dmitry, Tianfang Yang)
|
||||
|
||||
- Opcache
|
||||
. Fixed bug #75255 (Request hangs and not finish). (Dmitry)
|
||||
|
||||
- PCRE:
|
||||
. Fixed bug #75285 (Broken build when system libpcre don't have jit support).
|
||||
(Remi)
|
||||
|
||||
- Sodium:
|
||||
. Added missing bindings for libsodium > 1.0.13. (Frank)
|
||||
|
||||
28 Sep 2017, PHP 7.2.0RC3
|
||||
|
||||
- Core
|
||||
. Fixed bug #75241 (Null pointer dereference in zend_mm_alloc_small()).
|
||||
(Laruence)
|
||||
. Fixed bug #74878 (Data race in ZTS builds). (Nikita, Dmitry)
|
||||
. Fixed bug #75236 (infinite loop when printing an error-message). (Andrea)
|
||||
. Fixed bug #75252 (Incorrect token formatting on two parse errors in one
|
||||
request). (Nikita)
|
||||
|
||||
- FPM:
|
||||
. Fixed bug #75212 (php_value acts like php_admin_value). (Remi)
|
||||
|
||||
- MySQLi:
|
||||
. Fixed bug #75018 (Data corruption when reading fields of bit type). (Anatol)
|
||||
|
||||
- Opcache:
|
||||
. Fixed bug #75230 (Invalid opcode 49/1/8 using opcache). (Laruence)
|
||||
|
||||
- PCRE:
|
||||
. Fixed bug ##75223 (PCRE JIT broken in 7.2). (Dmitry)
|
||||
|
||||
- PDO_mysql:
|
||||
. Fixed bug #75177 (Type 'bit' is fetched as unexpected string). (Anatol)
|
||||
|
||||
- SPL:
|
||||
. Fixed bug #73629 (SplDoublyLinkedList::setIteratorMode masks intern flags).
|
||||
(J. Jeising, cmb)
|
||||
|
||||
14 Sep 2017, PHP 7.2.0RC2
|
||||
|
||||
- Core:
|
||||
. Fixed Bug #75142 (buildcheck.sh check for autoconf version needs to be updated
|
||||
for v2.64). (zizzy at zizzy dot net, Remi)
|
||||
|
||||
- BCMath:
|
||||
. Fixed bug #44995 (bcpowmod() fails if scale != 0). (cmb)
|
||||
. Fixed bug #46781 (BC math handles minus zero incorrectly). (cmb)
|
||||
. Fixed bug #54598 (bcpowmod() may return 1 if modulus is 1). (okano1220, cmb)
|
||||
. Fixed bug #75178 (bcpowmod() misbehaves for non-integer base or modulus). (cmb)
|
||||
|
||||
- CLI server:
|
||||
. Fixed bug #70470 (Built-in server truncates headers spanning over TCP
|
||||
packets). (bouk)
|
||||
|
||||
- Date:
|
||||
. Fixed bug #75149 (redefinition of typedefs ttinfo and t1info). (Remi)
|
||||
|
||||
- GD:
|
||||
. Fixed bug #75139 (libgd/gd_interpolation.c:1786: suspicious if ?). (cmb)
|
||||
|
||||
- Intl:
|
||||
. Fixed bug #75193 (segfault in collator_convert_object_to_string). (Remi)
|
||||
|
||||
- Gettext:
|
||||
. Fixed bug #73730 (textdomain(null) throws in strict mode). (cmb)
|
||||
|
||||
- Opcache
|
||||
. Fixed incorect constant conditional jump elimination. (Dmitry)
|
||||
|
||||
- OpenSSL
|
||||
. Automatically load OpenSSL configuration file. (Jakub Zelenka)
|
||||
|
||||
- SPL:
|
||||
. Fixed bug #75155 (AppendIterator::append() is broken when appending another
|
||||
AppendIterator). (Nikita)
|
||||
. Fixed bug #75173 (incorrect behavior of AppendIterator::append in foreach loop).
|
||||
(jhdxr)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #75152 (signed integer overflow in parse_iv). (Laruence)
|
||||
. Fixed bug #75170 (mt_rand() bias on 64-bit machines). (Nikita)
|
||||
|
||||
- ZIP:
|
||||
. Fixed bug #75143 (new method setEncryptionName() seems not to exist
|
||||
in ZipArchive). (Anatol)
|
||||
|
||||
31 Aug 2017, PHP 7.2.0RC1
|
||||
|
||||
- Core:
|
||||
. Fixed bug #75042 (run-tests.php issues with EXTENSION block). (John Boehr)
|
||||
|
||||
- CURL:
|
||||
. Fixed bug #75093 (OpenSSL support not detected). (Remi)
|
||||
. Better fix for #74125 (use pkg-config instead of curl-config). (Remi)
|
||||
|
||||
- GD:
|
||||
. Fixed bug #75111 (Memory disclosure or DoS via crafted .bmp image). (cmb)
|
||||
. Fixed bug #75124 (gdImageGrayScale() may produce colors). (cmb)
|
||||
|
||||
- Intl:
|
||||
. Fixed bug #75090 (IntlGregorianCalendar doesn't have constants from parent
|
||||
class). (tpunt)
|
||||
|
||||
- PCRE:
|
||||
. Fixed bug #75089 (preg_grep() is not reporting PREG_BAD_UTF8_ERROR after
|
||||
first input string). (Dmitry)
|
||||
|
||||
- PDO_OCI:
|
||||
. Fixed bug #74631 (PDO_PCO with PHP-FPM: OCI environment initialized
|
||||
before PHP-FPM sets it up). (Ingmar Runge)
|
||||
|
||||
- SQLite3:
|
||||
. Update to Sqlite 3.20.1. (cmb)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #75097 (gethostname fails if your host name is 64 chars long). (Andrea)
|
||||
|
||||
17 Aug 2017, PHP 7.2.0beta3
|
||||
|
||||
- Core:
|
||||
. Fixed bug #75063 (Main CWD initialized with wrong codepage). (Anatol)
|
||||
. Fixed bug #74725 (html_errors=1 breaks unhandled exceptions). (Andrea)
|
||||
|
||||
- Date:
|
||||
. Fixed bug #75002 (Null Pointer Dereference in timelib_time_clone). (Derick)
|
||||
|
||||
- FTP:
|
||||
. Added ftp_append() function. (blar)
|
||||
|
||||
- JSON:
|
||||
. Fixed bug #75185 (Buffer overflow in json_decode() with
|
||||
JSON_INVALID_UTF8_IGNORE or JSON_INVALID). (Jakub Zelenka)
|
||||
|
||||
- Mbstring:
|
||||
. Fixed bug #75001 (Wrong reflection on mb_eregi_replace). (Fabien
|
||||
Villepinte)
|
||||
|
||||
- SQLite3:
|
||||
. Updated to SQLite 3.20.0. (cmb)
|
||||
|
||||
- SPL:
|
||||
. Fixed bug #75049 (spl_autoload_unregister can't handle
|
||||
spl_autoload_functions results). (Laruence)
|
||||
. Added spl_object_id(). (Tyson Andre)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #75075 (unpack with X* causes infinity loop). (Laruence)
|
||||
. Fixed bug #74103 (heap-use-after-free when unserializing invalid array
|
||||
size). (Nikita)
|
||||
. Fixed bug #75054 (A Denial of Service Vulnerability was found when
|
||||
performing deserialization). (Nikita)
|
||||
|
||||
- WDDX:
|
||||
. Fixed bug #73793 (WDDX uses wrong decimal seperator). (cmb)
|
||||
|
||||
- XMLRPC:
|
||||
. Fixed bug #74975 (Incorrect xmlrpc serialization for classes with declared
|
||||
properties). (blar)
|
||||
|
||||
03 Aug 2017, PHP 7.2.0beta2
|
||||
|
||||
- Core:
|
||||
. Implemented FR #74963 (Improved error message on fetching property of
|
||||
non-object). (Laruence)
|
||||
. Fixed bug #74947 (Segfault in scanner on INF number). (Laruence)
|
||||
. Fixed bug #74954 (null deref and segfault in zend_generator_resume()). (Bob)
|
||||
. Fixed bug #75349 (NAN comparison). (Sara)
|
||||
|
||||
- CLI:
|
||||
. Fixed bug #74979 (Interactive shell opening instead of script execution
|
||||
@@ -302,6 +577,10 @@ PHP NEWS
|
||||
- Calendar:
|
||||
. Fix integer overflows (Joshua Rogers)
|
||||
|
||||
- CLI server:
|
||||
. Fixed bug #60471 (Random "Invalid request (unexpected EOF)" using a router
|
||||
script). (SammyK)
|
||||
|
||||
- Date:
|
||||
. Fixed bug #55407 (Impossible to prototype DateTime::createFromFormat).
|
||||
(kelunik)
|
||||
|
||||
@@ -24,7 +24,7 @@ PHP 7.2 UPGRADE NOTES
|
||||
closed resources.
|
||||
. is_object() will now return true for objects of class
|
||||
__PHP_Incomplete_Class.
|
||||
. Support for Netware operating systems have been removed.
|
||||
. Support for Netware operating systems has been removed.
|
||||
. Casting arrays to objects (with (object) or settype()) will now convert
|
||||
integer keys to string property names. This fixes the behaviour of previous
|
||||
versions, where integer keys would become inaccessible properties with
|
||||
@@ -94,6 +94,10 @@ PHP 7.2 UPGRADE NOTES
|
||||
sessions. Use output buffer just like web applications to resolve problems on
|
||||
CLI scripts.
|
||||
|
||||
- Standard:
|
||||
. Sequences generated by mt_rand() and rand() for a specific seed may differ
|
||||
from PHP 7.1 on 64-bit machines. This change was necessary to resolve a
|
||||
modulo bias bug in the implementation.
|
||||
|
||||
========================================
|
||||
2. New Features
|
||||
@@ -115,6 +119,11 @@ PHP 7.2 UPGRADE NOTES
|
||||
- DBA:
|
||||
. Implemented support for the LMDB backend.
|
||||
|
||||
- JSON:
|
||||
. Added JSON_INVALID_UTF8_IGNORE and JSON_INVALID_UTF8_SUBSTITUTE options for
|
||||
json_encode() and json_decode() to ignore and replace invalid UTF-8 byte
|
||||
sequences, respectively.
|
||||
|
||||
- OCI8:
|
||||
. Added Oracle Database Transparent Application Failover (TAF) callback support.
|
||||
|
||||
@@ -169,9 +178,11 @@ PHP 8.0.
|
||||
. The create_function() function has been deprecated, use anonymous functions
|
||||
instead.
|
||||
. The each() function has been deprecated, use a foreach loop instead.
|
||||
. The $errcontext error handler argument has been deprecated. However, using
|
||||
it does not trigger a deprecation warning for technical reasons.
|
||||
|
||||
- EXIF:
|
||||
. The read_exif_data() alias have been deprecated, use exif_read_data() instead.
|
||||
. The read_exif_data() alias has been deprecated, use exif_read_data() instead.
|
||||
|
||||
- GD:
|
||||
. png2wbmp() and jpeg2wbmp() have been deprecated.
|
||||
@@ -233,15 +244,21 @@ See also: https://wiki.php.net/rfc/deprecations_php_7_2
|
||||
. DomNodeList implements Countable, added DomNodeList::count().
|
||||
. DOMNamedNodeMap implements Countable, added DOMNamedNodeMap::count().
|
||||
|
||||
- FTP:
|
||||
. Added ftp_append().
|
||||
|
||||
- GD:
|
||||
. Added imagesetclip() and imagegetclip().
|
||||
. Added imageopenpolygon().
|
||||
. Added imageresolution().
|
||||
. Added imagecreatefrombmp() and imagebmp().
|
||||
|
||||
- Hash:
|
||||
. Added hash_hmac_algos().
|
||||
|
||||
- Mbstring:
|
||||
. Added mb_chr() and mb_ord().
|
||||
. Added mb_scurb() that scrub broken multibyte strings.
|
||||
. Added mb_scrub() that scrubs broken multibyte strings.
|
||||
|
||||
- OCI8:
|
||||
. Added oci_register_taf_callback() and oci_disable_taf_callback() for
|
||||
@@ -251,6 +268,9 @@ See also: https://wiki.php.net/rfc/deprecations_php_7_2
|
||||
. Added socket_addrinfo_lookup(), socket_addrinfo_connect(),
|
||||
socket_addrinfo_bind() and socket_addrinfo_explain().
|
||||
|
||||
- SPL:
|
||||
. Added spl_object_id().
|
||||
|
||||
========================================
|
||||
7. New Classes and Interfaces
|
||||
========================================
|
||||
@@ -331,7 +351,7 @@ See also: https://wiki.php.net/rfc/deprecations_php_7_2
|
||||
========================================
|
||||
|
||||
- sql.safe_mode
|
||||
. This INI directive have been removed.
|
||||
. This INI directive has been removed.
|
||||
|
||||
- realpath_cache_size
|
||||
. Set to 4096k by default
|
||||
@@ -351,3 +371,6 @@ See also: https://wiki.php.net/rfc/deprecations_php_7_2
|
||||
13. Other Changes
|
||||
========================================
|
||||
|
||||
- Build system
|
||||
|
||||
Autoconf minimal version is now 2.64.
|
||||
@@ -0,0 +1,13 @@
|
||||
--TEST--
|
||||
Bug #75241 (Null pointer dereference in zend_mm_alloc_small())
|
||||
--FILE--
|
||||
<?php
|
||||
function eh(){}
|
||||
|
||||
set_error_handler('eh');
|
||||
|
||||
$d->d = &$d + $d->d/=0;
|
||||
var_dump($d);
|
||||
?>
|
||||
--EXPECT--
|
||||
float(INF)
|
||||
@@ -0,0 +1,28 @@
|
||||
--TEST--
|
||||
Bug #75252: Incorrect token formatting on two parse errors in one request
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$code = <<<'CODE'
|
||||
function test_missing_semicolon() : string {
|
||||
$x = []
|
||||
FOO
|
||||
}
|
||||
CODE;
|
||||
|
||||
try {
|
||||
eval($code);
|
||||
} catch (ParseError $e) {
|
||||
var_dump($e->getMessage());
|
||||
}
|
||||
|
||||
try {
|
||||
eval($code);
|
||||
} catch (ParseError $e) {
|
||||
var_dump($e->getMessage());
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
string(41) "syntax error, unexpected 'FOO' (T_STRING)"
|
||||
string(41) "syntax error, unexpected 'FOO' (T_STRING)"
|
||||
@@ -0,0 +1,26 @@
|
||||
--TEST--
|
||||
Bug #75290 (debug info of Closures of internal functions contain garbage argument names)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
var_dump((new ReflectionFunction('sin'))->getClosure());
|
||||
|
||||
var_dump(function ($someThing) {});
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
object(Closure)#2 (1) {
|
||||
["parameter"]=>
|
||||
array(1) {
|
||||
["$number"]=>
|
||||
string(10) "<required>"
|
||||
}
|
||||
}
|
||||
object(Closure)#2 (1) {
|
||||
["parameter"]=>
|
||||
array(1) {
|
||||
["$someThing"]=>
|
||||
string(10) "<required>"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
--TEST--
|
||||
Bug #75420.1 (Indirect modification of magic method argument)
|
||||
--FILE--
|
||||
<?php
|
||||
class Test {
|
||||
public function __isset($x) { $GLOBALS["name"] = 24; return true; }
|
||||
public function __get($x) { var_dump($x); return 42; }
|
||||
}
|
||||
|
||||
$obj = new Test;
|
||||
$name = "foo";
|
||||
var_dump($obj->$name ?? 12);
|
||||
var_dump($name);
|
||||
?>
|
||||
--EXPECT--
|
||||
string(3) "foo"
|
||||
int(42)
|
||||
int(24)
|
||||
@@ -0,0 +1,21 @@
|
||||
--TEST--
|
||||
Bug #75420.10 (Indirect modification of magic method argument)
|
||||
--FILE--
|
||||
<?php
|
||||
class Test implements ArrayAccess {
|
||||
public function offsetExists($x) { $GLOBALS["name"] = 24; return true; }
|
||||
public function offsetGet($x) { var_dump($x); return 42; }
|
||||
public function offsetSet($x, $y) { }
|
||||
public function offsetUnset($x) { }
|
||||
}
|
||||
|
||||
$obj = new Test;
|
||||
$name = "foo";
|
||||
$name = str_repeat($name, 2);
|
||||
var_dump($obj[$name] ?? 12);
|
||||
var_dump($name);
|
||||
?>
|
||||
--EXPECT--
|
||||
string(6) "foofoo"
|
||||
int(42)
|
||||
int(24)
|
||||
@@ -0,0 +1,20 @@
|
||||
--TEST--
|
||||
Bug #75420.11 (Indirect modification of magic method argument)
|
||||
--FILE--
|
||||
<?php
|
||||
class Test implements ArrayAccess {
|
||||
public function offsetExists($x) { $GLOBALS["name"] = 24; return true; }
|
||||
public function offsetGet($x) { var_dump($x); return 42; }
|
||||
public function offsetSet($x, $y) { }
|
||||
public function offsetUnset($x) { }
|
||||
}
|
||||
|
||||
$obj = new Test;
|
||||
$name = "foo";
|
||||
var_dump(empty($obj[$name]));
|
||||
var_dump($name);
|
||||
?>
|
||||
--EXPECT--
|
||||
string(3) "foo"
|
||||
bool(false)
|
||||
int(24)
|
||||
@@ -0,0 +1,21 @@
|
||||
--TEST--
|
||||
Bug #75420.12 (Indirect modification of magic method argument)
|
||||
--FILE--
|
||||
<?php
|
||||
class Test implements ArrayAccess {
|
||||
public function offsetExists($x) { $GLOBALS["name"] = 24; return true; }
|
||||
public function offsetGet($x) { var_dump($x); return 42; }
|
||||
public function offsetSet($x, $y) { }
|
||||
public function offsetUnset($x) { }
|
||||
}
|
||||
|
||||
$obj = new Test;
|
||||
$name = "foo";
|
||||
$name = str_repeat($name, 2);
|
||||
var_dump(empty($obj[$name]));
|
||||
var_dump($name);
|
||||
?>
|
||||
--EXPECT--
|
||||
string(6) "foofoo"
|
||||
bool(false)
|
||||
int(24)
|
||||
@@ -0,0 +1,20 @@
|
||||
--TEST--
|
||||
Bug #75420.13 (Indirect modification of magic method argument)
|
||||
--FILE--
|
||||
<?php
|
||||
class Test implements ArrayAccess {
|
||||
public function offsetExists($x) { $GLOBALS["obj"] = 24; return true; }
|
||||
public function offsetGet($x) { var_dump($x); return 42; }
|
||||
public function offsetSet($x, $y) { }
|
||||
public function offsetUnset($x) { }
|
||||
}
|
||||
|
||||
$obj = new Test;
|
||||
$name = "foo";
|
||||
var_dump($obj[$name] ?? 12);
|
||||
var_dump($obj);
|
||||
?>
|
||||
--EXPECT--
|
||||
string(3) "foo"
|
||||
int(42)
|
||||
int(24)
|
||||
@@ -0,0 +1,20 @@
|
||||
--TEST--
|
||||
Bug #75420.14 (Indirect modification of magic method argument)
|
||||
--FILE--
|
||||
<?php
|
||||
class Test implements ArrayAccess {
|
||||
public function offsetExists($x) { $GLOBALS["obj"] = 24; return true; }
|
||||
public function offsetGet($x) { var_dump($x); return 42; }
|
||||
public function offsetSet($x, $y) { }
|
||||
public function offsetUnset($x) { }
|
||||
}
|
||||
|
||||
$obj = new Test;
|
||||
$name = "foo";
|
||||
var_dump(empty($obj[$name]));
|
||||
var_dump($obj);
|
||||
?>
|
||||
--EXPECT--
|
||||
string(3) "foo"
|
||||
bool(false)
|
||||
int(24)
|
||||
@@ -0,0 +1,20 @@
|
||||
--TEST--
|
||||
Bug #75420.15 (Indirect modification of magic method argument)
|
||||
--FILE--
|
||||
<?php
|
||||
class Test implements ArrayAccess {
|
||||
public function offsetExists($x) { }
|
||||
public function offsetGet($x) { }
|
||||
public function offsetSet($x, $y) { $GLOBALS["name"] = 24; var_dump($x); }
|
||||
public function offsetUnset($x) { }
|
||||
}
|
||||
|
||||
$obj = new Test;
|
||||
$name = "foo";
|
||||
$name = str_repeat($name, 2);
|
||||
$obj[$name] = 1;
|
||||
var_dump($name);
|
||||
?>
|
||||
--EXPECT--
|
||||
string(6) "foofoo"
|
||||
int(24)
|
||||
@@ -0,0 +1,20 @@
|
||||
--TEST--
|
||||
Bug #75420.16 (Indirect modification of magic method argument)
|
||||
--FILE--
|
||||
<?php
|
||||
class Test implements ArrayAccess {
|
||||
public function offsetExists($x) { }
|
||||
public function offsetGet($x) { }
|
||||
public function offsetSet($x, $y) { $GLOBALS["obj"] = 24; var_dump($this); }
|
||||
public function offsetUnset($x) { }
|
||||
}
|
||||
|
||||
$obj = new Test;
|
||||
$name = "foo";
|
||||
$obj[$name] = 1;
|
||||
var_dump($obj);
|
||||
?>
|
||||
--EXPECT--
|
||||
object(Test)#1 (0) {
|
||||
}
|
||||
int(24)
|
||||
@@ -0,0 +1,20 @@
|
||||
--TEST--
|
||||
Bug #75420.2 (Indirect modification of magic method argument)
|
||||
--FILE--
|
||||
<?php
|
||||
class Test {
|
||||
public function __isset($x) { $GLOBALS["name"] = 24; return true; }
|
||||
public function __get($x) { var_dump($x); return 42; }
|
||||
}
|
||||
|
||||
$obj = new Test;
|
||||
$name = "foo";
|
||||
$name = str_repeat($name, 2);
|
||||
var_dump($obj->$name ?? 12);
|
||||
var_dump($name);
|
||||
?>
|
||||
--EXPECT--
|
||||
string(6) "foofoo"
|
||||
int(42)
|
||||
int(24)
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
--TEST--
|
||||
Bug #75420.3 (Indirect modification of magic method argument)
|
||||
--FILE--
|
||||
<?php
|
||||
class Test {
|
||||
public function __isset($x) { $GLOBALS["name"] = 24; return true; }
|
||||
public function __get($x) { var_dump($x); return 42; }
|
||||
}
|
||||
|
||||
$obj = new Test;
|
||||
$name = "foo";
|
||||
var_dump(empty($obj->$name));
|
||||
var_dump($name);
|
||||
?>
|
||||
--EXPECT--
|
||||
string(3) "foo"
|
||||
bool(false)
|
||||
int(24)
|
||||
@@ -0,0 +1,17 @@
|
||||
--TEST--
|
||||
Bug #75420.4 (Indirect modification of magic method argument)
|
||||
--FILE--
|
||||
<?php
|
||||
class Test {
|
||||
public function __isset($x) { $GLOBALS["name"] = 24; return true; }
|
||||
public function __get($x) { var_dump($x); return 42; }
|
||||
}
|
||||
|
||||
$obj = new Test;
|
||||
$name = "foo";
|
||||
$name = str_repeat($name, 2);
|
||||
var_dump(empty($obj->$name));
|
||||
?>
|
||||
--EXPECT--
|
||||
string(6) "foofoo"
|
||||
bool(false)
|
||||
@@ -0,0 +1,19 @@
|
||||
--TEST--
|
||||
Bug #75420.5 (Indirect modification of magic method argument)
|
||||
--FILE--
|
||||
<?php
|
||||
class Test {
|
||||
public function __isset($x) { $GLOBALS["obj"] = 24; return true; }
|
||||
public function __get($x) { var_dump($this); return 42; }
|
||||
}
|
||||
|
||||
$obj = new Test;
|
||||
$name = "foo";
|
||||
var_dump($obj->$name ?? 12);
|
||||
var_dump($obj);
|
||||
?>
|
||||
--EXPECT--
|
||||
object(Test)#1 (0) {
|
||||
}
|
||||
int(42)
|
||||
int(24)
|
||||
@@ -0,0 +1,19 @@
|
||||
--TEST--
|
||||
Bug #75420.6 (Indirect modification of magic method argument)
|
||||
--FILE--
|
||||
<?php
|
||||
class Test {
|
||||
public function __isset($x) { $GLOBALS["obj"] = 24; return true; }
|
||||
public function __get($x) { var_dump($this); return 42; }
|
||||
}
|
||||
|
||||
$obj = new Test;
|
||||
$name = "foo";
|
||||
var_dump(empty($obj->$name));
|
||||
var_dump($obj);
|
||||
?>
|
||||
--EXPECT--
|
||||
object(Test)#1 (0) {
|
||||
}
|
||||
bool(false)
|
||||
int(24)
|
||||
@@ -0,0 +1,17 @@
|
||||
--TEST--
|
||||
Bug #75420.7 (Indirect modification of magic method argument)
|
||||
--FILE--
|
||||
<?php
|
||||
class Test {
|
||||
public function __set($x,$v) { $GLOBALS["name"] = 24; var_dump($x); }
|
||||
}
|
||||
|
||||
$obj = new Test;
|
||||
$name = "foo";
|
||||
$name = str_repeat($name, 2);
|
||||
$obj->$name = 1;
|
||||
var_dump($name);
|
||||
?>
|
||||
--EXPECT--
|
||||
string(6) "foofoo"
|
||||
int(24)
|
||||
@@ -0,0 +1,17 @@
|
||||
--TEST--
|
||||
Bug #75420.8 (Indirect modification of magic method argument)
|
||||
--FILE--
|
||||
<?php
|
||||
class Test {
|
||||
public function __set($x,$v) { $GLOBALS["obj"] = 24; var_dump($this); }
|
||||
}
|
||||
|
||||
$obj = new Test;
|
||||
$name = "foo";
|
||||
$obj->$name = 1;
|
||||
var_dump($obj);
|
||||
?>
|
||||
--EXPECT--
|
||||
object(Test)#1 (0) {
|
||||
}
|
||||
int(24)
|
||||
@@ -0,0 +1,20 @@
|
||||
--TEST--
|
||||
Bug #75420.9 (Indirect modification of magic method argument)
|
||||
--FILE--
|
||||
<?php
|
||||
class Test implements ArrayAccess {
|
||||
public function offsetExists($x) { $GLOBALS["name"] = 24; return true; }
|
||||
public function offsetGet($x) { var_dump($x); return 42; }
|
||||
public function offsetSet($x, $y) { }
|
||||
public function offsetUnset($x) { }
|
||||
}
|
||||
|
||||
$obj = new Test;
|
||||
$name = "foo";
|
||||
var_dump($obj[$name] ?? 12);
|
||||
var_dump($name);
|
||||
?>
|
||||
--EXPECT--
|
||||
string(3) "foo"
|
||||
int(42)
|
||||
int(24)
|
||||
@@ -0,0 +1,17 @@
|
||||
--TEST--
|
||||
Bug #75420 (Crash when modifing property name in __isset for BP_VAR_IS)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class Test {
|
||||
public function __isset($x) { $GLOBALS["name"] = 24; return true; }
|
||||
public function __get($x) { var_dump($x); return 42; }
|
||||
}
|
||||
|
||||
$obj = new Test;
|
||||
$name = "foo";
|
||||
var_dump($obj->$name ?? 12);
|
||||
?>
|
||||
--EXPECT--
|
||||
string(3) "foo"
|
||||
int(42)
|
||||
@@ -0,0 +1,17 @@
|
||||
--TEST--
|
||||
Attempt to free invalid structure (result of ROPE_INIT is not a zval)
|
||||
--FILE--
|
||||
<?php
|
||||
set_error_handler(function () {
|
||||
throw new Exception();
|
||||
});
|
||||
$a = [];
|
||||
$b = "";
|
||||
try {
|
||||
echo "$a$b\n";
|
||||
} catch (Exception $ex) {
|
||||
}
|
||||
?>
|
||||
DONE
|
||||
--EXPECT--
|
||||
DONE
|
||||
@@ -0,0 +1,16 @@
|
||||
--TEST--
|
||||
Live ranges should be ordered according to "start" position
|
||||
--FILE--
|
||||
<?php
|
||||
set_error_handler(function($no, $msg) { throw new Exception; });
|
||||
|
||||
try {
|
||||
$a = [];
|
||||
$str = "$a${"y$a$a"}y";
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
?>
|
||||
DONE
|
||||
--EXPECT--
|
||||
DONE
|
||||
|
||||
+7
-1
@@ -717,6 +717,10 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions) /
|
||||
extern zend_php_scanner_globals language_scanner_globals;
|
||||
#endif
|
||||
|
||||
#ifdef ZEND_WIN32
|
||||
php_win32_cp_set_by_id(65001);
|
||||
#endif
|
||||
|
||||
start_memory_manager();
|
||||
|
||||
virtual_cwd_startup(); /* Could use shutdown to free the main cwd but it would just slow it down for CGI */
|
||||
@@ -769,7 +773,7 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions) /
|
||||
zend_compile_file = compile_file;
|
||||
zend_execute_ex = execute_ex;
|
||||
zend_execute_internal = NULL;
|
||||
#endif /* HAVE_SYS_SDT_H */
|
||||
#endif /* HAVE_DTRACE */
|
||||
zend_compile_string = compile_string;
|
||||
zend_throw_exception_hook = NULL;
|
||||
|
||||
@@ -943,6 +947,8 @@ void zend_set_utility_values(zend_utility_values *utility_values) /* {{{ */
|
||||
/* this should be compatible with the standard zenderror */
|
||||
ZEND_COLD void zenderror(const char *error) /* {{{ */
|
||||
{
|
||||
CG(parse_error) = 0;
|
||||
|
||||
if (EG(exception)) {
|
||||
/* An exception was thrown in the lexer, don't throw another in the parser. */
|
||||
return;
|
||||
|
||||
@@ -283,7 +283,6 @@ ZEND_COLD void zenderror(const char *error);
|
||||
#define ZEND_STANDARD_CLASS_DEF_PTR zend_standard_class_def
|
||||
extern ZEND_API zend_class_entry *zend_standard_class_def;
|
||||
extern ZEND_API zend_utility_values zend_uv;
|
||||
extern ZEND_API zval zval_used_for_init;
|
||||
|
||||
/* If DTrace is available and enabled */
|
||||
extern ZEND_API zend_bool zend_dtrace_enabled;
|
||||
|
||||
+10
-3
@@ -3129,7 +3129,8 @@ get_function_via_handler:
|
||||
(!fcc->function_handler->common.scope ||
|
||||
!instanceof_function(ce_org, fcc->function_handler->common.scope))) {
|
||||
if (fcc->function_handler->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE) {
|
||||
if (fcc->function_handler->type != ZEND_OVERLOADED_FUNCTION) {
|
||||
if (fcc->function_handler->type != ZEND_OVERLOADED_FUNCTION &&
|
||||
fcc->function_handler->common.function_name) {
|
||||
zend_string_release(fcc->function_handler->common.function_name);
|
||||
}
|
||||
zend_free_trampoline(fcc->function_handler);
|
||||
@@ -3355,7 +3356,8 @@ again:
|
||||
((fcc->function_handler->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE) ||
|
||||
fcc->function_handler->type == ZEND_OVERLOADED_FUNCTION_TEMPORARY ||
|
||||
fcc->function_handler->type == ZEND_OVERLOADED_FUNCTION)) {
|
||||
if (fcc->function_handler->type != ZEND_OVERLOADED_FUNCTION) {
|
||||
if (fcc->function_handler->type != ZEND_OVERLOADED_FUNCTION &&
|
||||
fcc->function_handler->common.function_name) {
|
||||
zend_string_release(fcc->function_handler->common.function_name);
|
||||
}
|
||||
zend_free_trampoline(fcc->function_handler);
|
||||
@@ -3413,7 +3415,8 @@ again:
|
||||
((fcc->function_handler->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE) ||
|
||||
fcc->function_handler->type == ZEND_OVERLOADED_FUNCTION_TEMPORARY ||
|
||||
fcc->function_handler->type == ZEND_OVERLOADED_FUNCTION)) {
|
||||
if (fcc->function_handler->type != ZEND_OVERLOADED_FUNCTION) {
|
||||
if (fcc->function_handler->type != ZEND_OVERLOADED_FUNCTION &&
|
||||
fcc->function_handler->common.function_name) {
|
||||
zend_string_release(fcc->function_handler->common.function_name);
|
||||
}
|
||||
zend_free_trampoline(fcc->function_handler);
|
||||
@@ -3741,7 +3744,11 @@ ZEND_API int zend_declare_property_ex(zend_class_entry *ce, zend_string *name, z
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
/* Must be interned to avoid ZTS data races */
|
||||
name = zend_new_interned_string(zend_string_copy(name));
|
||||
}
|
||||
|
||||
if (access_type & ZEND_ACC_PUBLIC) {
|
||||
property_info->name = zend_string_copy(name);
|
||||
} else if (access_type & ZEND_ACC_PRIVATE) {
|
||||
|
||||
+20
-2
@@ -260,6 +260,8 @@ struct _zend_mm_heap {
|
||||
int peak_chunks_count; /* peak number of allocated chunks for current request */
|
||||
int cached_chunks_count; /* number of cached chunks */
|
||||
double avg_chunks_count; /* average number of chunks allocated per request */
|
||||
int last_chunks_delete_boundary; /* numer of chunks after last deletion */
|
||||
int last_chunks_delete_count; /* number of deletion over the last boundary */
|
||||
#if ZEND_MM_CUSTOM
|
||||
union {
|
||||
struct {
|
||||
@@ -283,7 +285,7 @@ struct _zend_mm_chunk {
|
||||
uint32_t free_pages; /* number of free pages */
|
||||
uint32_t free_tail; /* number of free pages at the end of chunk */
|
||||
uint32_t num;
|
||||
char reserve[64 - (sizeof(void*) * 3 + sizeof(int) * 3)];
|
||||
char reserve[64 - (sizeof(void*) * 3 + sizeof(uint32_t) * 3)];
|
||||
zend_mm_heap heap_slot; /* used only in main chunk */
|
||||
zend_mm_page_map free_map; /* 512 bits or 64 bytes */
|
||||
zend_mm_page_info map[ZEND_MM_PAGES]; /* 2 KB = 512 * 4 */
|
||||
@@ -1076,7 +1078,9 @@ static zend_always_inline void zend_mm_delete_chunk(zend_mm_heap *heap, zend_mm_
|
||||
chunk->next->prev = chunk->prev;
|
||||
chunk->prev->next = chunk->next;
|
||||
heap->chunks_count--;
|
||||
if (heap->chunks_count + heap->cached_chunks_count < heap->avg_chunks_count + 0.1) {
|
||||
if (heap->chunks_count + heap->cached_chunks_count < heap->avg_chunks_count + 0.1
|
||||
|| (heap->chunks_count == heap->last_chunks_delete_boundary
|
||||
&& heap->last_chunks_delete_count >= 4)) {
|
||||
/* delay deletion */
|
||||
heap->cached_chunks_count++;
|
||||
chunk->next = heap->cached_chunks;
|
||||
@@ -1085,6 +1089,14 @@ static zend_always_inline void zend_mm_delete_chunk(zend_mm_heap *heap, zend_mm_
|
||||
#if ZEND_MM_STAT || ZEND_MM_LIMIT
|
||||
heap->real_size -= ZEND_MM_CHUNK_SIZE;
|
||||
#endif
|
||||
if (!heap->cached_chunks) {
|
||||
if (heap->chunks_count != heap->last_chunks_delete_boundary) {
|
||||
heap->last_chunks_delete_boundary = heap->chunks_count;
|
||||
heap->last_chunks_delete_count = 0;
|
||||
} else {
|
||||
heap->last_chunks_delete_count++;
|
||||
}
|
||||
}
|
||||
if (!heap->cached_chunks || chunk->num > heap->cached_chunks->num) {
|
||||
zend_mm_chunk_free(heap, chunk, ZEND_MM_CHUNK_SIZE);
|
||||
} else {
|
||||
@@ -1819,6 +1831,8 @@ static zend_mm_heap *zend_mm_init(void)
|
||||
heap->peak_chunks_count = 1;
|
||||
heap->cached_chunks_count = 0;
|
||||
heap->avg_chunks_count = 1.0;
|
||||
heap->last_chunks_delete_boundary = 0;
|
||||
heap->last_chunks_delete_count = 0;
|
||||
#if ZEND_MM_STAT || ZEND_MM_LIMIT
|
||||
heap->real_size = ZEND_MM_CHUNK_SIZE;
|
||||
#endif
|
||||
@@ -2235,6 +2249,8 @@ void zend_mm_shutdown(zend_mm_heap *heap, int full, int silent)
|
||||
p->map[0] = ZEND_MM_LRUN(ZEND_MM_FIRST_PAGE);
|
||||
heap->chunks_count = 1;
|
||||
heap->peak_chunks_count = 1;
|
||||
heap->last_chunks_delete_boundary = 0;
|
||||
heap->last_chunks_delete_count = 0;
|
||||
#if ZEND_MM_STAT || ZEND_MM_LIMIT
|
||||
heap->real_size = ZEND_MM_CHUNK_SIZE;
|
||||
#endif
|
||||
@@ -2758,6 +2774,8 @@ ZEND_API zend_mm_heap *zend_mm_startup_ex(const zend_mm_handlers *handlers, void
|
||||
heap->peak_chunks_count = 1;
|
||||
heap->cached_chunks_count = 0;
|
||||
heap->avg_chunks_count = 1.0;
|
||||
heap->last_chunks_delete_boundary = 0;
|
||||
heap->last_chunks_delete_count = 0;
|
||||
#if ZEND_MM_STAT || ZEND_MM_LIMIT
|
||||
heap->real_size = ZEND_MM_CHUNK_SIZE;
|
||||
#endif
|
||||
|
||||
@@ -193,6 +193,10 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_set_exception_handler, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, exception_handler)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_get_defined_functions, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, exclude_disabled)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_create_function, 0, 0, 2)
|
||||
ZEND_ARG_INFO(0, args)
|
||||
ZEND_ARG_INFO(0, code)
|
||||
@@ -270,7 +274,7 @@ static const zend_function_entry builtin_functions[] = { /* {{{ */
|
||||
ZEND_FE(get_declared_classes, arginfo_zend__void)
|
||||
ZEND_FE(get_declared_traits, arginfo_zend__void)
|
||||
ZEND_FE(get_declared_interfaces, arginfo_zend__void)
|
||||
ZEND_FE(get_defined_functions, arginfo_zend__void)
|
||||
ZEND_FE(get_defined_functions, arginfo_get_defined_functions)
|
||||
ZEND_FE(get_defined_vars, arginfo_zend__void)
|
||||
ZEND_DEP_FE(create_function, arginfo_create_function)
|
||||
ZEND_FE(get_resource_type, arginfo_get_resource_type)
|
||||
@@ -1176,7 +1180,7 @@ ZEND_FUNCTION(get_object_vars)
|
||||
*/
|
||||
zend_hash_str_add_new(Z_ARRVAL_P(return_value), prop_name, prop_len, value);
|
||||
} else {
|
||||
zend_symbtable_add_new(Z_ARRVAL_P(return_value), key, value);
|
||||
zend_symtable_add_new(Z_ARRVAL_P(return_value), key, value);
|
||||
}
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
}
|
||||
|
||||
+10
-3
@@ -500,6 +500,7 @@ static HashTable *zend_closure_get_debug_info(zval *object, int *is_temp) /* {{{
|
||||
zval val;
|
||||
struct _zend_arg_info *arg_info = closure->func.common.arg_info;
|
||||
HashTable *debug_info;
|
||||
zend_bool zstr_args = (closure->func.type == ZEND_USER_FUNCTION) || (closure->func.common.fn_flags & ZEND_ACC_USER_ARG_INFO);
|
||||
|
||||
*is_temp = 1;
|
||||
|
||||
@@ -532,9 +533,15 @@ static HashTable *zend_closure_get_debug_info(zval *object, int *is_temp) /* {{{
|
||||
zend_string *name;
|
||||
zval info;
|
||||
if (arg_info->name) {
|
||||
name = zend_strpprintf(0, "%s$%s",
|
||||
arg_info->pass_by_reference ? "&" : "",
|
||||
ZSTR_VAL(arg_info->name));
|
||||
if (zstr_args) {
|
||||
name = zend_strpprintf(0, "%s$%s",
|
||||
arg_info->pass_by_reference ? "&" : "",
|
||||
ZSTR_VAL(arg_info->name));
|
||||
} else {
|
||||
name = zend_strpprintf(0, "%s$%s",
|
||||
arg_info->pass_by_reference ? "&" : "",
|
||||
((zend_internal_arg_info*)arg_info)->name);
|
||||
}
|
||||
} else {
|
||||
name = zend_strpprintf(0, "%s$param%d",
|
||||
arg_info->pass_by_reference ? "&" : "",
|
||||
|
||||
+1
-1
@@ -7844,7 +7844,7 @@ static void zend_compile_encaps_list(znode *result, zend_ast *ast) /* {{{ */
|
||||
GET_NODE(result, opline->result);
|
||||
} else {
|
||||
uint32_t var;
|
||||
uint32_t range = zend_start_live_range(CG(active_op_array), rope_init_lineno);
|
||||
uint32_t range = zend_start_live_range_ex(CG(active_op_array), rope_init_lineno);
|
||||
|
||||
init_opline->extended_value = j;
|
||||
opline->opcode = ZEND_ROPE_END;
|
||||
|
||||
@@ -843,6 +843,7 @@ static zend_always_inline zend_bool zend_check_type(
|
||||
if (EXPECTED(Z_TYPE_P(arg) == IS_OBJECT)) {
|
||||
return instanceof_function(Z_OBJCE_P(arg), *ce);
|
||||
}
|
||||
return Z_TYPE_P(arg) == IS_NULL && (ZEND_TYPE_ALLOW_NULL(type) || (default_value && is_null_constant(scope, default_value)));
|
||||
} else if (EXPECTED(ZEND_TYPE_CODE(type) == Z_TYPE_P(arg))) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
+1
-1
@@ -346,7 +346,7 @@ static zend_always_inline int zend_hash_str_exists_ind(const HashTable *ht, cons
|
||||
Z_TYPE_P(Z_INDIRECT_P(zv)) != IS_UNDEF);
|
||||
}
|
||||
|
||||
static zend_always_inline zval *zend_symbtable_add_new(HashTable *ht, zend_string *key, zval *pData)
|
||||
static zend_always_inline zval *zend_symtable_add_new(HashTable *ht, zend_string *key, zval *pData)
|
||||
{
|
||||
zend_ulong idx;
|
||||
|
||||
|
||||
+60
-31
@@ -562,9 +562,10 @@ ZEND_API uint32_t *zend_get_property_guard(zend_object *zobj, zend_string *membe
|
||||
zval *zend_std_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv) /* {{{ */
|
||||
{
|
||||
zend_object *zobj;
|
||||
zval tmp_member;
|
||||
zval tmp_member, tmp_object;
|
||||
zval *retval;
|
||||
uint32_t property_offset;
|
||||
uint32_t *guard = NULL;
|
||||
|
||||
zobj = Z_OBJ_P(object);
|
||||
|
||||
@@ -597,12 +598,18 @@ zval *zend_std_read_property(zval *object, zval *member, int type, void **cache_
|
||||
goto exit;
|
||||
}
|
||||
|
||||
ZVAL_UNDEF(&tmp_object);
|
||||
|
||||
/* magic isset */
|
||||
if ((type == BP_VAR_IS) && zobj->ce->__isset) {
|
||||
zval tmp_object, tmp_result;
|
||||
uint32_t *guard = zend_get_property_guard(zobj, Z_STR_P(member));
|
||||
zval tmp_result;
|
||||
guard = zend_get_property_guard(zobj, Z_STR_P(member));
|
||||
|
||||
if (!((*guard) & IN_ISSET)) {
|
||||
if (Z_TYPE(tmp_member) == IS_UNDEF) {
|
||||
ZVAL_COPY(&tmp_member, member);
|
||||
member = &tmp_member;
|
||||
}
|
||||
ZVAL_COPY(&tmp_object, object);
|
||||
ZVAL_UNDEF(&tmp_result);
|
||||
|
||||
@@ -617,19 +624,20 @@ zval *zend_std_read_property(zval *object, zval *member, int type, void **cache_
|
||||
goto exit;
|
||||
}
|
||||
|
||||
zval_ptr_dtor(&tmp_object);
|
||||
zval_ptr_dtor(&tmp_result);
|
||||
}
|
||||
}
|
||||
|
||||
/* magic get */
|
||||
if (zobj->ce->__get) {
|
||||
uint32_t *guard = zend_get_property_guard(zobj, Z_STR_P(member));
|
||||
if (guard == NULL) {
|
||||
guard = zend_get_property_guard(zobj, Z_STR_P(member));
|
||||
}
|
||||
if (!((*guard) & IN_GET)) {
|
||||
zval tmp_object;
|
||||
|
||||
/* have getter - try with it! */
|
||||
ZVAL_COPY(&tmp_object, object);
|
||||
if (Z_TYPE(tmp_object) == IS_UNDEF) {
|
||||
ZVAL_COPY(&tmp_object, object);
|
||||
}
|
||||
*guard |= IN_GET; /* prevent circular getting */
|
||||
zend_std_call_getter(&tmp_object, member, rv);
|
||||
*guard &= ~IN_GET;
|
||||
@@ -649,6 +657,7 @@ zval *zend_std_read_property(zval *object, zval *member, int type, void **cache_
|
||||
zval_ptr_dtor(&tmp_object);
|
||||
goto exit;
|
||||
} else {
|
||||
zval_ptr_dtor(&tmp_object);
|
||||
if (Z_STRVAL_P(member)[0] == '\0' && Z_STRLEN_P(member) != 0) {
|
||||
zend_throw_error(NULL, "Cannot access property started with '\\0'");
|
||||
retval = &EG(uninitialized_zval);
|
||||
@@ -656,6 +665,9 @@ zval *zend_std_read_property(zval *object, zval *member, int type, void **cache_
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
zval_ptr_dtor(&tmp_object);
|
||||
|
||||
if ((type != BP_VAR_IS)) {
|
||||
zend_error(E_NOTICE,"Undefined property: %s::$%s", ZSTR_VAL(zobj->ce->name), Z_STRVAL_P(member));
|
||||
}
|
||||
@@ -764,34 +776,38 @@ exit:
|
||||
zval *zend_std_read_dimension(zval *object, zval *offset, int type, zval *rv) /* {{{ */
|
||||
{
|
||||
zend_class_entry *ce = Z_OBJCE_P(object);
|
||||
zval tmp;
|
||||
zval tmp_offset, tmp_object;
|
||||
|
||||
if (EXPECTED(instanceof_function_ex(ce, zend_ce_arrayaccess, 1) != 0)) {
|
||||
if (offset == NULL) {
|
||||
/* [] construct */
|
||||
ZVAL_NULL(&tmp);
|
||||
offset = &tmp;
|
||||
ZVAL_NULL(&tmp_offset);
|
||||
} else {
|
||||
SEPARATE_ARG_IF_REF(offset);
|
||||
ZVAL_DEREF(offset);
|
||||
ZVAL_COPY(&tmp_offset, offset);
|
||||
}
|
||||
|
||||
ZVAL_COPY(&tmp_object, object);
|
||||
if (type == BP_VAR_IS) {
|
||||
zend_call_method_with_1_params(object, ce, NULL, "offsetexists", rv, offset);
|
||||
zend_call_method_with_1_params(&tmp_object, ce, NULL, "offsetexists", rv, &tmp_offset);
|
||||
if (UNEXPECTED(Z_ISUNDEF_P(rv))) {
|
||||
zval_ptr_dtor(offset);
|
||||
zval_ptr_dtor(&tmp_object);
|
||||
zval_ptr_dtor(&tmp_offset);
|
||||
return NULL;
|
||||
}
|
||||
if (!i_zend_is_true(rv)) {
|
||||
zval_ptr_dtor(offset);
|
||||
zval_ptr_dtor(&tmp_object);
|
||||
zval_ptr_dtor(&tmp_offset);
|
||||
zval_ptr_dtor(rv);
|
||||
return &EG(uninitialized_zval);
|
||||
}
|
||||
zval_ptr_dtor(rv);
|
||||
}
|
||||
|
||||
zend_call_method_with_1_params(object, ce, NULL, "offsetget", rv, offset);
|
||||
zend_call_method_with_1_params(&tmp_object, ce, NULL, "offsetget", rv, &tmp_offset);
|
||||
|
||||
zval_ptr_dtor(offset);
|
||||
zval_ptr_dtor(&tmp_object);
|
||||
zval_ptr_dtor(&tmp_offset);
|
||||
|
||||
if (UNEXPECTED(Z_TYPE_P(rv) == IS_UNDEF)) {
|
||||
if (UNEXPECTED(!EG(exception))) {
|
||||
@@ -810,17 +826,19 @@ zval *zend_std_read_dimension(zval *object, zval *offset, int type, zval *rv) /*
|
||||
static void zend_std_write_dimension(zval *object, zval *offset, zval *value) /* {{{ */
|
||||
{
|
||||
zend_class_entry *ce = Z_OBJCE_P(object);
|
||||
zval tmp;
|
||||
zval tmp_offset, tmp_object;
|
||||
|
||||
if (EXPECTED(instanceof_function_ex(ce, zend_ce_arrayaccess, 1) != 0)) {
|
||||
if (!offset) {
|
||||
ZVAL_NULL(&tmp);
|
||||
offset = &tmp;
|
||||
ZVAL_NULL(&tmp_offset);
|
||||
} else {
|
||||
SEPARATE_ARG_IF_REF(offset);
|
||||
ZVAL_DEREF(offset);
|
||||
ZVAL_COPY(&tmp_offset, offset);
|
||||
}
|
||||
zend_call_method_with_2_params(object, ce, NULL, "offsetset", NULL, offset, value);
|
||||
zval_ptr_dtor(offset);
|
||||
ZVAL_COPY(&tmp_object, object);
|
||||
zend_call_method_with_2_params(&tmp_object, ce, NULL, "offsetset", NULL, &tmp_offset, value);
|
||||
zval_ptr_dtor(&tmp_object);
|
||||
zval_ptr_dtor(&tmp_offset);
|
||||
} else {
|
||||
zend_throw_error(NULL, "Cannot use object of type %s as array", ZSTR_VAL(ce->name));
|
||||
}
|
||||
@@ -830,17 +848,19 @@ static void zend_std_write_dimension(zval *object, zval *offset, zval *value) /*
|
||||
static int zend_std_has_dimension(zval *object, zval *offset, int check_empty) /* {{{ */
|
||||
{
|
||||
zend_class_entry *ce = Z_OBJCE_P(object);
|
||||
zval retval;
|
||||
zval retval, tmp_offset, tmp_object;
|
||||
int result;
|
||||
|
||||
if (EXPECTED(instanceof_function_ex(ce, zend_ce_arrayaccess, 1) != 0)) {
|
||||
SEPARATE_ARG_IF_REF(offset);
|
||||
zend_call_method_with_1_params(object, ce, NULL, "offsetexists", &retval, offset);
|
||||
ZVAL_DEREF(offset);
|
||||
ZVAL_COPY(&tmp_offset, offset);
|
||||
ZVAL_COPY(&tmp_object, object);
|
||||
zend_call_method_with_1_params(&tmp_object, ce, NULL, "offsetexists", &retval, &tmp_offset);
|
||||
if (EXPECTED(Z_TYPE(retval) != IS_UNDEF)) {
|
||||
result = i_zend_is_true(&retval);
|
||||
zval_ptr_dtor(&retval);
|
||||
if (check_empty && result && EXPECTED(!EG(exception))) {
|
||||
zend_call_method_with_1_params(object, ce, NULL, "offsetget", &retval, offset);
|
||||
zend_call_method_with_1_params(&tmp_object, ce, NULL, "offsetget", &retval, &tmp_offset);
|
||||
if (EXPECTED(Z_TYPE(retval) != IS_UNDEF)) {
|
||||
result = i_zend_is_true(&retval);
|
||||
zval_ptr_dtor(&retval);
|
||||
@@ -849,7 +869,8 @@ static int zend_std_has_dimension(zval *object, zval *offset, int check_empty) /
|
||||
} else {
|
||||
result = 0;
|
||||
}
|
||||
zval_ptr_dtor(offset);
|
||||
zval_ptr_dtor(&tmp_object);
|
||||
zval_ptr_dtor(&tmp_offset);
|
||||
} else {
|
||||
zend_throw_error(NULL, "Cannot use object of type %s as array", ZSTR_VAL(ce->name));
|
||||
return 0;
|
||||
@@ -1006,11 +1027,15 @@ exit:
|
||||
static void zend_std_unset_dimension(zval *object, zval *offset) /* {{{ */
|
||||
{
|
||||
zend_class_entry *ce = Z_OBJCE_P(object);
|
||||
zval tmp_offset, tmp_object;
|
||||
|
||||
if (instanceof_function_ex(ce, zend_ce_arrayaccess, 1)) {
|
||||
SEPARATE_ARG_IF_REF(offset);
|
||||
zend_call_method_with_1_params(object, ce, NULL, "offsetunset", NULL, offset);
|
||||
zval_ptr_dtor(offset);
|
||||
ZVAL_DEREF(offset);
|
||||
ZVAL_COPY(&tmp_offset, offset);
|
||||
ZVAL_COPY(&tmp_object, object);
|
||||
zend_call_method_with_1_params(&tmp_object, ce, NULL, "offsetunset", NULL, &tmp_offset);
|
||||
zval_ptr_dtor(&tmp_object);
|
||||
zval_ptr_dtor(&tmp_offset);
|
||||
} else {
|
||||
zend_throw_error(NULL, "Cannot use object of type %s as array", ZSTR_VAL(ce->name));
|
||||
}
|
||||
@@ -1561,6 +1586,10 @@ found:
|
||||
zval tmp_object;
|
||||
|
||||
/* have issetter - try with it! */
|
||||
if (Z_TYPE(tmp_member) == IS_UNDEF) {
|
||||
ZVAL_COPY(&tmp_member, member);
|
||||
member = &tmp_member;
|
||||
}
|
||||
ZVAL_COPY(&tmp_object, object);
|
||||
(*guard) |= IN_ISSET; /* prevent circular getting */
|
||||
zend_std_call_issetter(&tmp_object, member, &rv);
|
||||
|
||||
@@ -142,6 +142,25 @@ ZEND_API void zend_function_dtor(zval *zv)
|
||||
ZEND_ASSERT(function->type == ZEND_INTERNAL_FUNCTION);
|
||||
ZEND_ASSERT(function->common.function_name);
|
||||
zend_string_release(function->common.function_name);
|
||||
#ifndef ZTS
|
||||
if ((function->common.fn_flags & (ZEND_ACC_HAS_RETURN_TYPE|ZEND_ACC_HAS_TYPE_HINTS)) &&
|
||||
!function->common.scope && function->common.arg_info) {
|
||||
|
||||
uint32_t i;
|
||||
uint32_t num_args = function->common.num_args + 1;
|
||||
zend_arg_info *arg_info = function->common.arg_info - 1;
|
||||
|
||||
if (function->common.fn_flags & ZEND_ACC_VARIADIC) {
|
||||
num_args++;
|
||||
}
|
||||
for (i = 0 ; i < num_args; i++) {
|
||||
if (ZEND_TYPE_IS_CLASS(arg_info[i].type)) {
|
||||
zend_string_release(ZEND_TYPE_NAME(arg_info[i].type));
|
||||
}
|
||||
}
|
||||
free(arg_info);
|
||||
}
|
||||
#endif
|
||||
if (!(function->common.fn_flags & ZEND_ACC_ARENA_ALLOCATED)) {
|
||||
pefree(function, 1);
|
||||
}
|
||||
@@ -227,6 +246,9 @@ ZEND_API void destroy_zend_class(zval *zv)
|
||||
{
|
||||
zend_property_info *prop_info;
|
||||
zend_class_entry *ce = Z_PTR_P(zv);
|
||||
#ifndef ZTS
|
||||
zend_function *fn;
|
||||
#endif
|
||||
|
||||
if (--ce->refcount > 0) {
|
||||
return;
|
||||
@@ -310,6 +332,15 @@ ZEND_API void destroy_zend_class(zval *zv)
|
||||
}
|
||||
zend_hash_destroy(&ce->properties_info);
|
||||
zend_string_release(ce->name);
|
||||
#ifndef ZTS
|
||||
ZEND_HASH_FOREACH_PTR(&ce->function_table, fn) {
|
||||
if ((fn->common.fn_flags & (ZEND_ACC_HAS_RETURN_TYPE|ZEND_ACC_HAS_TYPE_HINTS)) &&
|
||||
fn->common.scope == ce) {
|
||||
/* reset function scope to allow arg_info removing */
|
||||
fn->common.scope = NULL;
|
||||
}
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
#endif
|
||||
zend_hash_destroy(&ce->function_table);
|
||||
if (zend_hash_num_elements(&ce->constants_table)) {
|
||||
zend_class_constant *c;
|
||||
|
||||
@@ -225,8 +225,10 @@ ZEND_API void ZEND_FASTCALL convert_scalar_to_number(zval *op) /* {{{ */
|
||||
if (Z_TYPE(holder) == IS_LONG) { \
|
||||
if (op == result) { \
|
||||
zval_ptr_dtor(op); \
|
||||
ZVAL_LONG(op, Z_LVAL(holder)); \
|
||||
} else { \
|
||||
(op) = &(holder); \
|
||||
} \
|
||||
(op) = &(holder); \
|
||||
} \
|
||||
break; \
|
||||
} \
|
||||
|
||||
@@ -167,8 +167,10 @@ ZEND_API void ZEND_FASTCALL _zval_copy_ctor_func(zval *zvalue ZEND_FILE_LINE_DC)
|
||||
{
|
||||
if (EXPECTED(Z_TYPE_P(zvalue) == IS_ARRAY)) {
|
||||
ZVAL_ARR(zvalue, zend_array_dup(Z_ARRVAL_P(zvalue)));
|
||||
} else if (EXPECTED(Z_TYPE_P(zvalue) == IS_STRING) ||
|
||||
EXPECTED(Z_TYPE_P(zvalue) == IS_CONSTANT)) {
|
||||
} else if (EXPECTED(Z_TYPE_P(zvalue) == IS_STRING)) {
|
||||
CHECK_ZVAL_STRING_REL(Z_STR_P(zvalue));
|
||||
ZVAL_NEW_STR(zvalue, zend_string_dup(Z_STR_P(zvalue), 0));
|
||||
} else if (EXPECTED(Z_TYPE_P(zvalue) == IS_CONSTANT)) {
|
||||
CHECK_ZVAL_STRING_REL(Z_STR_P(zvalue));
|
||||
Z_STR_P(zvalue) = zend_string_dup(Z_STR_P(zvalue), 0);
|
||||
} else if (EXPECTED(Z_TYPE_P(zvalue) == IS_CONSTANT_AST)) {
|
||||
|
||||
+13
-3
@@ -389,16 +389,21 @@ static void cwd_globals_dtor(virtual_cwd_globals *cwd_g) /* {{{ */
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
CWD_API void virtual_cwd_startup(void) /* {{{ */
|
||||
void virtual_cwd_main_cwd_init(uint8_t reinit) /* {{{ */
|
||||
{
|
||||
char cwd[MAXPATHLEN];
|
||||
char *result;
|
||||
|
||||
if (reinit) {
|
||||
free(main_cwd_state.cwd);
|
||||
}
|
||||
|
||||
#ifdef ZEND_WIN32
|
||||
ZeroMemory(&cwd, sizeof(cwd));
|
||||
#endif
|
||||
result = php_win32_ioutil_getcwd(cwd, sizeof(cwd));
|
||||
#else
|
||||
result = getcwd(cwd, sizeof(cwd));
|
||||
#endif
|
||||
|
||||
if (!result) {
|
||||
cwd[0] = '\0';
|
||||
@@ -411,7 +416,12 @@ CWD_API void virtual_cwd_startup(void) /* {{{ */
|
||||
}
|
||||
#endif
|
||||
main_cwd_state.cwd = strdup(cwd);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
CWD_API void virtual_cwd_startup(void) /* {{{ */
|
||||
{
|
||||
virtual_cwd_main_cwd_init(0);
|
||||
#ifdef ZTS
|
||||
ts_allocate_id(&cwd_globals_id, sizeof(virtual_cwd_globals), (ts_allocate_ctor) cwd_globals_ctor, (ts_allocate_dtor) cwd_globals_dtor);
|
||||
#else
|
||||
@@ -606,7 +616,7 @@ CWD_API void realpath_cache_del(const char *path, size_t path_len) /* {{{ */
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static inline void realpath_cache_add(const char *path, int path_len, const char *realpath, size_t realpath_len, int is_dir, time_t t) /* {{{ */
|
||||
static inline void realpath_cache_add(const char *path, size_t path_len, const char *realpath, size_t realpath_len, int is_dir, time_t t) /* {{{ */
|
||||
{
|
||||
zend_long size = sizeof(realpath_cache_bucket) + path_len + 1;
|
||||
int same = 1;
|
||||
|
||||
@@ -238,6 +238,10 @@ CWD_API zend_long realpath_cache_size(void);
|
||||
CWD_API zend_long realpath_cache_max_buckets(void);
|
||||
CWD_API realpath_cache_bucket** realpath_cache_get_buckets(void);
|
||||
|
||||
#ifdef CWD_EXPORTS
|
||||
extern void virtual_cwd_main_cwd_init(uint8_t);
|
||||
#endif
|
||||
|
||||
/* The actual macros to be used in programs using TSRM
|
||||
* If the program defines VIRTUAL_DIR it will use the
|
||||
* virtual_* functions
|
||||
|
||||
@@ -7080,6 +7080,7 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY)
|
||||
if (throw_op->result_type & (IS_VAR | IS_TMP_VAR)) {
|
||||
switch (throw_op->opcode) {
|
||||
case ZEND_ADD_ARRAY_ELEMENT:
|
||||
case ZEND_ROPE_INIT:
|
||||
case ZEND_ROPE_ADD:
|
||||
break; /* exception while building structures, live range handling will free those */
|
||||
|
||||
|
||||
@@ -1776,6 +1776,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(
|
||||
if (throw_op->result_type & (IS_VAR | IS_TMP_VAR)) {
|
||||
switch (throw_op->opcode) {
|
||||
case ZEND_ADD_ARRAY_ELEMENT:
|
||||
case ZEND_ROPE_INIT:
|
||||
case ZEND_ROPE_ADD:
|
||||
break; /* exception while building structures, live range handling will free those */
|
||||
|
||||
|
||||
+11
-2
@@ -2,6 +2,7 @@
|
||||
|
||||
set SDK_REMOTE=https://github.com/OSTC/php-sdk-binary-tools.git
|
||||
set SDK_BRANCH=%PHP_BUILD_SDK_BRANCH%
|
||||
set SDK_RUNNER=%PHP_BUILD_CACHE_SDK_DIR%\phpsdk-%PHP_BUILD_CRT%-%PLATFORM%.bat
|
||||
|
||||
if not exist "%PHP_BUILD_CACHE_BASE_DIR%" (
|
||||
echo Creating %PHP_BUILD_CACHE_BASE_DIR%
|
||||
@@ -13,17 +14,25 @@ if not exist "%PHP_BUILD_OBJ_DIR%" (
|
||||
mkdir "%PHP_BUILD_OBJ_DIR%"
|
||||
)
|
||||
|
||||
if not exist "%SDK_RUNNER%" (
|
||||
if exist "%PHP_BUILD_CACHE_SDK_DIR%" rmdir /s /q "%PHP_BUILD_CACHE_SDK_DIR%"
|
||||
)
|
||||
|
||||
if not exist "%PHP_BUILD_CACHE_SDK_DIR%" (
|
||||
echo Cloning remote SDK repository
|
||||
git clone --branch %SDK_BRANCH% %SDK_REMOTE% "%PHP_BUILD_CACHE_SDK_DIR%" 2>&1
|
||||
) else (
|
||||
)
|
||||
|
||||
for /f "tokens=*" %%a in ('type %PHP_BUILD_CACHE_SDK_DIR%\VERSION') do set GOT_SDK_VER=%%a
|
||||
echo Got SDK version %GOT_SDK_VER%
|
||||
if NOT "%GOT_SDK_VER%" == "%PHP_BUILD_SDK_BRANCH:~8%" (
|
||||
echo Switching to the configured SDK version %SDK_BRANCH:~8%
|
||||
echo Fetching remote SDK repository
|
||||
git --git-dir="%PHP_BUILD_CACHE_SDK_DIR%\.git" --work-tree="%PHP_BUILD_CACHE_SDK_DIR%" fetch --prune origin 2>&1
|
||||
echo Checkout SDK repository branch
|
||||
git --git-dir="%PHP_BUILD_CACHE_SDK_DIR%\.git" --work-tree="%PHP_BUILD_CACHE_SDK_DIR%" checkout --force %SDK_BRANCH%
|
||||
)
|
||||
|
||||
set SDK_RUNNER=%PHP_BUILD_CACHE_SDK_DIR%\phpsdk-%PHP_BUILD_CRT%-%PLATFORM%.bat
|
||||
if not exist "%SDK_RUNNER%" (
|
||||
echo "%SDK_RUNNER%" doesn't exist
|
||||
exit /b 3
|
||||
|
||||
@@ -8,6 +8,8 @@ if "%APPVEYOR%" equ "True" rmdir /s /q C:\mingw >NUL 2>NUL
|
||||
if %errorlevel% neq 0 exit /b 3
|
||||
if "%APPVEYOR%" equ "True" rmdir /s /q C:\mingw-w64 >NUL 2>NUL
|
||||
if %errorlevel% neq 0 exit /b 3
|
||||
if "%APPVEYOR%" equ "True" rmdir /s /q C:\msys64 >NUL 2>NUL
|
||||
if %errorlevel% neq 0 exit /b 3
|
||||
|
||||
cd /D %APPVEYOR_BUILD_FOLDER%
|
||||
if %errorlevel% neq 0 exit /b 3
|
||||
|
||||
+4
-4
@@ -28,18 +28,18 @@ if test -z "$PHP_AUTOCONF"; then
|
||||
PHP_AUTOCONF='autoconf'
|
||||
fi
|
||||
|
||||
# autoconf 2.59 or newer
|
||||
# autoconf 2.64 or newer
|
||||
ac_version=`$PHP_AUTOCONF --version 2>/dev/null|head -n 1|sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'`
|
||||
if test -z "$ac_version"; then
|
||||
echo "buildconf: autoconf not found."
|
||||
echo " You need autoconf version 2.59 or newer installed"
|
||||
echo " You need autoconf version 2.64 or newer installed"
|
||||
echo " to build PHP from Git."
|
||||
exit 1
|
||||
fi
|
||||
IFS=.; set $ac_version; IFS=' '
|
||||
if test "$1" = "2" -a "$2" -lt "59" || test "$1" -lt "2"; then
|
||||
if test "$1" = "2" -a "$2" -lt "64" || test "$1" -lt "2"; then
|
||||
echo "buildconf: autoconf version $ac_version found."
|
||||
echo " You need autoconf version 2.59 or newer installed"
|
||||
echo " You need autoconf version 2.64 or newer installed"
|
||||
echo " to build PHP from Git."
|
||||
exit 1
|
||||
else
|
||||
|
||||
+1
-1
@@ -108,7 +108,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
|
||||
PHP_MAJOR_VERSION=7
|
||||
PHP_MINOR_VERSION=2
|
||||
PHP_RELEASE_VERSION=0
|
||||
PHP_EXTRA_VERSION="-dev"
|
||||
PHP_EXTRA_VERSION="RC6"
|
||||
PHP_VERSION="$PHP_MAJOR_VERSION.$PHP_MINOR_VERSION.$PHP_RELEASE_VERSION$PHP_EXTRA_VERSION"
|
||||
PHP_VERSION_ID=`expr [$]PHP_MAJOR_VERSION \* 10000 + [$]PHP_MINOR_VERSION \* 100 + [$]PHP_RELEASE_VERSION`
|
||||
|
||||
|
||||
+17
-4
@@ -60,9 +60,10 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_bcdiv, 0, 0, 2)
|
||||
ZEND_ARG_INFO(0, scale)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO(arginfo_bcmod, 0)
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_bcmod, 0, 0, 2)
|
||||
ZEND_ARG_INFO(0, left_operand)
|
||||
ZEND_ARG_INFO(0, right_operand)
|
||||
ZEND_ARG_INFO(0, scale)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_bcpowmod, 0, 0, 3)
|
||||
@@ -388,26 +389,38 @@ PHP_FUNCTION(bcdiv)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto string bcmod(string left_operand, string right_operand)
|
||||
/* {{{ proto string bcmod(string left_operand, string right_operand [, int scale])
|
||||
Returns the modulus of the two arbitrary precision operands */
|
||||
PHP_FUNCTION(bcmod)
|
||||
{
|
||||
zend_string *left, *right;
|
||||
zend_long scale_param = 0;
|
||||
bc_num first, second, result;
|
||||
int scale = (int)BCG(bc_precision);
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(2, 2)
|
||||
ZEND_PARSE_PARAMETERS_START(2, 3)
|
||||
Z_PARAM_STR(left)
|
||||
Z_PARAM_STR(right)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_LONG(scale_param)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
if (ZEND_NUM_ARGS() == 3) {
|
||||
scale = (int) ((int)scale_param < 0 ? 0 : scale_param);
|
||||
}
|
||||
|
||||
bc_init_num(&first);
|
||||
bc_init_num(&second);
|
||||
bc_init_num(&result);
|
||||
php_str2num(&first, ZSTR_VAL(left));
|
||||
php_str2num(&second, ZSTR_VAL(right));
|
||||
|
||||
switch (bc_modulo(first, second, &result, 0)) {
|
||||
switch (bc_modulo(first, second, &result, scale)) {
|
||||
case 0:
|
||||
if (result->n_scale > scale) {
|
||||
result = split_bc_num(result);
|
||||
result->n_scale = scale;
|
||||
}
|
||||
RETVAL_STR(bc_num2str(result));
|
||||
break;
|
||||
case -1:
|
||||
|
||||
@@ -59,7 +59,7 @@ bc_divmod (bc_num num1, bc_num num2, bc_num *quot, bc_num *rem, int scale)
|
||||
bc_init_num(&temp);
|
||||
|
||||
/* Calculate it. */
|
||||
bc_divide (num1, num2, &temp, scale);
|
||||
bc_divide (num1, num2, &temp, 0);
|
||||
if (quot)
|
||||
quotient = bc_copy_num (temp);
|
||||
bc_multiply (temp, num2, &temp, rscale);
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
int
|
||||
bc_raisemod (bc_num base, bc_num expo, bc_num mod, bc_num *result, int scale)
|
||||
{
|
||||
bc_num power, exponent, parity, temp;
|
||||
bc_num power, exponent, modulus, parity, temp;
|
||||
int rscale;
|
||||
|
||||
/* Check for correct numbers. */
|
||||
@@ -55,12 +55,16 @@ bc_raisemod (bc_num base, bc_num expo, bc_num mod, bc_num *result, int scale)
|
||||
/* Set initial values. */
|
||||
power = bc_copy_num (base);
|
||||
exponent = bc_copy_num (expo);
|
||||
modulus = bc_copy_num (mod);
|
||||
temp = bc_copy_num (BCG(_one_));
|
||||
bc_init_num(&parity);
|
||||
|
||||
/* Check the base for scale digits. */
|
||||
if (base->n_scale != 0)
|
||||
if (power->n_scale != 0)
|
||||
{
|
||||
bc_rt_warn ("non-zero scale in base");
|
||||
bc_divide (power, BCG(_one_), &power, 0); /*truncate */
|
||||
}
|
||||
|
||||
/* Check the exponent for scale digits. */
|
||||
if (exponent->n_scale != 0)
|
||||
@@ -70,27 +74,38 @@ bc_raisemod (bc_num base, bc_num expo, bc_num mod, bc_num *result, int scale)
|
||||
}
|
||||
|
||||
/* Check the modulus for scale digits. */
|
||||
if (mod->n_scale != 0)
|
||||
if (modulus->n_scale != 0)
|
||||
{
|
||||
bc_rt_warn ("non-zero scale in modulus");
|
||||
bc_divide (modulus, BCG(_one_), &modulus, 0); /*truncate */
|
||||
}
|
||||
|
||||
/* Do the calculation. */
|
||||
rscale = MAX(scale, base->n_scale);
|
||||
while ( !bc_is_zero(exponent) )
|
||||
rscale = MAX(scale, power->n_scale);
|
||||
if ( !bc_compare(modulus, BCG(_one_)) )
|
||||
{
|
||||
(void) bc_divmod (exponent, BCG(_two_), &exponent, &parity, 0);
|
||||
if ( !bc_is_zero(parity) )
|
||||
temp = bc_new_num (1, scale);
|
||||
}
|
||||
else
|
||||
{
|
||||
while ( !bc_is_zero(exponent) )
|
||||
{
|
||||
bc_multiply (temp, power, &temp, rscale);
|
||||
(void) bc_modulo (temp, mod, &temp, scale);
|
||||
}
|
||||
(void) bc_divmod (exponent, BCG(_two_), &exponent, &parity, 0);
|
||||
if ( !bc_is_zero(parity) )
|
||||
{
|
||||
bc_multiply (temp, power, &temp, rscale);
|
||||
(void) bc_modulo (temp, modulus, &temp, scale);
|
||||
}
|
||||
|
||||
bc_multiply (power, power, &power, rscale);
|
||||
(void) bc_modulo (power, mod, &power, scale);
|
||||
bc_multiply (power, power, &power, rscale);
|
||||
(void) bc_modulo (power, modulus, &power, scale);
|
||||
}
|
||||
}
|
||||
|
||||
/* Assign the value. */
|
||||
bc_free_num (&power);
|
||||
bc_free_num (&exponent);
|
||||
bc_free_num (&modulus);
|
||||
bc_free_num (result);
|
||||
bc_free_num (&parity);
|
||||
*result = temp;
|
||||
|
||||
@@ -105,5 +105,8 @@ bc_str2num (bc_num *num, char *str, int scale)
|
||||
for (;strscale > 0; strscale--)
|
||||
*nptr++ = CH_VAL(*ptr++);
|
||||
}
|
||||
|
||||
if (bc_is_zero (*num))
|
||||
(*num)->n_sign = PLUS;
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ bcmath.scale=0
|
||||
echo bcmod("11", "2"),"\n";
|
||||
echo bcmod("-1", "5"),"\n";
|
||||
echo bcmod("8728932001983192837219398127471", "1928372132132819737213"),"\n";
|
||||
echo bcmod("3.5", "4"),"\n";
|
||||
echo bcmod("3.5", "4", 1),"\n";
|
||||
echo bcmod("1071", "357.5"),"\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
@@ -17,4 +17,4 @@ echo bcmod("1071", "357.5"),"\n";
|
||||
-1
|
||||
1459434331351930289678
|
||||
3.5
|
||||
356.0
|
||||
356
|
||||
@@ -7,7 +7,7 @@ antoni@solucionsinternet.com
|
||||
<?php if(!extension_loaded("bcmath")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
echo bcmod('1', '2', '3');
|
||||
echo bcmod('1', '2', '3', '4');
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: bcmod() expects exactly 2 parameters, 3 given in %s.php on line %d
|
||||
Warning: bcmod() expects at most 3 parameters, 4 given in %s.php on line %d
|
||||
@@ -0,0 +1,16 @@
|
||||
--TEST--
|
||||
Bug #44995 (bcpowmod() fails if scale != 0)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('bcmath')) die('skip bcmath extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(bcpowmod('4', '4', '3', 1));
|
||||
var_dump(bcpowmod('3234', '32345', '22345', 1));
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
string(3) "1.0"
|
||||
string(7) "17334.0"
|
||||
===DONE===
|
||||
@@ -0,0 +1,16 @@
|
||||
--TEST--
|
||||
Bug #46781 (BC math handles minus zero incorrectly)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('bcmath')) die('skip bcmath extension is not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(bcadd('-0.0', '-0.0', 1));
|
||||
var_dump(bccomp('-0.0', '0', 1));
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
string(3) "0.0"
|
||||
int(0)
|
||||
===DONE===
|
||||
@@ -0,0 +1,16 @@
|
||||
--TEST--
|
||||
Bug #54598 (bcpowmod() may return 1 if modulus is 1)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('bcmath')) die('skip bcmath extension is not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(bcpowmod(5, 0, 1));
|
||||
var_dump(bcpowmod(5, 0, 1, 3));
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
string(1) "0"
|
||||
string(5) "0.000"
|
||||
===DONE===
|
||||
@@ -0,0 +1,21 @@
|
||||
--TEST--
|
||||
Bug #75178 (bcpowmod() misbehaves for non-integer base or modulus)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('bcmath')) die('skip bcmath extension is not available');
|
||||
if (substr(PHP_OS, 0, 3) != 'WIN') {
|
||||
die('skip valid only for windows');
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(bcpowmod('4.1', '4', '3', 3));
|
||||
var_dump(bcpowmod('4', '4', '3.1', 3));
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
string(5) "1.000"
|
||||
string(5) "1.000"
|
||||
===DONE===
|
||||
bc math warning: non-zero scale in base
|
||||
bc math warning: non-zero scale in modulus
|
||||
@@ -0,0 +1,21 @@
|
||||
--TEST--
|
||||
Bug #75178 (bcpowmod() misbehaves for non-integer base or modulus)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('bcmath')) die('skip bcmath extension is not available');
|
||||
if (substr(PHP_OS, 0, 3) == 'WIN') {
|
||||
die('skip Not valid for windows');
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(bcpowmod('4.1', '4', '3', 3));
|
||||
var_dump(bcpowmod('4', '4', '3.1', 3));
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
bc math warning: non-zero scale in base
|
||||
string(5) "1.000"
|
||||
bc math warning: non-zero scale in modulus
|
||||
string(5) "1.000"
|
||||
===DONE===
|
||||
+82
-53
@@ -6,73 +6,101 @@ PHP_ARG_WITH(curl, for cURL support,
|
||||
[ --with-curl[=DIR] Include cURL support])
|
||||
|
||||
if test "$PHP_CURL" != "no"; then
|
||||
if test -r $PHP_CURL/include/curl/easy.h; then
|
||||
CURL_DIR=$PHP_CURL
|
||||
if test -z "$PKG_CONFIG"; then
|
||||
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
|
||||
fi
|
||||
|
||||
if test -x "$PKG_CONFIG"; then
|
||||
dnl using pkg-config output
|
||||
|
||||
AC_MSG_CHECKING(for libcurl.pc)
|
||||
if test "$PHP_CURL" == "yes" -o "$PHP_CURL" == "/usr"; then
|
||||
PKNAME=libcurl
|
||||
AC_MSG_RESULT(using default path)
|
||||
elif test -r $PHP_CURL/$PHP_LIBDIR/pkgconfig/libcurl.pc; then
|
||||
PKNAME=$PHP_CURL/$PHP_LIBDIR/pkgconfig/libcurl.pc
|
||||
AC_MSG_RESULT(using $PKNAME)
|
||||
elif test -r $PHP_CURL/lib/pkgconfig/libcurl.pc; then
|
||||
PKNAME=$PHP_CURL/lib/pkgconfig/libcurl.pc
|
||||
AC_MSG_RESULT(using $PKNAME)
|
||||
else
|
||||
AC_MSG_RESULT(not found)
|
||||
AC_MSG_WARN(Could not find libcurl.pc. Try without $PHP_CURL or set PKG_CONFIG_PATH)
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -n "$PKNAME"; then
|
||||
AC_MSG_CHECKING(for cURL 7.10.5 or greater)
|
||||
if $PKG_CONFIG --atleast-version 7.10.5 $PKNAME; then
|
||||
curl_version_full=`$PKG_CONFIG --modversion $PKNAME`
|
||||
AC_MSG_RESULT($curl_version_full)
|
||||
else
|
||||
AC_MSG_ERROR(cURL version 7.10.5 or later is required to compile php with cURL support)
|
||||
fi
|
||||
|
||||
CURL_LIBS=`$PKG_CONFIG --libs $PKNAME`
|
||||
CURL_INCL=`$PKG_CONFIG --cflags $PKNAME`
|
||||
CURL_SSL=`$PKG_CONFIG --variable=supported_features $PKNAME| $EGREP SSL`
|
||||
else
|
||||
AC_MSG_CHECKING(for cURL in default path)
|
||||
for i in /usr/local /usr; do
|
||||
if test -r $i/include/curl/easy.h; then
|
||||
CURL_DIR=$i
|
||||
AC_MSG_RESULT(found in $i)
|
||||
break
|
||||
fi
|
||||
done
|
||||
dnl fallback to old vay, using curl-config
|
||||
AC_MSG_WARN(Fallback: search for curl headers and curl-config)
|
||||
|
||||
if test -r $PHP_CURL/include/curl/easy.h; then
|
||||
CURL_DIR=$PHP_CURL
|
||||
else
|
||||
AC_MSG_CHECKING(for cURL in default path)
|
||||
for i in /usr/local /usr; do
|
||||
if test -r $i/include/curl/easy.h; then
|
||||
CURL_DIR=$i
|
||||
AC_MSG_RESULT(found in $i)
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if test -z "$CURL_DIR"; then
|
||||
AC_MSG_RESULT(not found)
|
||||
if which dpkg-architecture>/dev/null; then
|
||||
AC_MSG_CHECKING(for cURL in multiarch path)
|
||||
CURL_MULTIARCH_INCLUDE=/usr/include/$(dpkg-architecture -qDEB_HOST_MULTIARCH)
|
||||
if test -r $CURL_MULTIARCH_INCLUDE/curl/easy.h; then
|
||||
CURL_DIR=/usr
|
||||
AC_MSG_RESULT(found in $CURL_MULTIARCH_INCLUDE)
|
||||
else
|
||||
AC_MSG_RESULT(not found)
|
||||
fi
|
||||
AC_MSG_ERROR(Please reinstall the libcurl distribution -
|
||||
easy.h should be in <curl-dir>/include/curl/)
|
||||
fi
|
||||
|
||||
CURL_CONFIG="curl-config"
|
||||
AC_MSG_CHECKING(for cURL 7.10.5 or greater)
|
||||
|
||||
if ${CURL_DIR}/bin/curl-config --libs > /dev/null 2>&1; then
|
||||
CURL_CONFIG=${CURL_DIR}/bin/curl-config
|
||||
else
|
||||
if ${CURL_DIR}/curl-config --libs > /dev/null 2>&1; then
|
||||
CURL_CONFIG=${CURL_DIR}/curl-config
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -z "$CURL_DIR"; then
|
||||
AC_MSG_ERROR(Could not find cURL, please reinstall the libcurl distribution -
|
||||
easy.h should be in <curl-dir>/include/curl/)
|
||||
fi
|
||||
|
||||
CURL_CONFIG="curl-config"
|
||||
AC_MSG_CHECKING(for cURL 7.10.5 or greater)
|
||||
|
||||
if ${CURL_DIR}/bin/curl-config --libs > /dev/null 2>&1; then
|
||||
CURL_CONFIG=${CURL_DIR}/bin/curl-config
|
||||
else
|
||||
if ${CURL_DIR}/curl-config --libs > /dev/null 2>&1; then
|
||||
CURL_CONFIG=${CURL_DIR}/curl-config
|
||||
curl_version_full=`$CURL_CONFIG --version`
|
||||
curl_version=`echo ${curl_version_full} | sed -e 's/libcurl //' | $AWK 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
|
||||
if test "$curl_version" -ge 7010005; then
|
||||
AC_MSG_RESULT($curl_version_full)
|
||||
CURL_LIBS=`$CURL_CONFIG --libs`
|
||||
CURL_INCL=`$CURL_CONFIG --cflags`
|
||||
CURL_SSL=`$CURL_CONFIG --feature | $EGREP SSL`
|
||||
else
|
||||
AC_MSG_ERROR(cURL version 7.10.5 or later is required to compile php with cURL support)
|
||||
fi
|
||||
fi
|
||||
|
||||
curl_version_full=`$CURL_CONFIG --version`
|
||||
curl_version=`echo ${curl_version_full} | sed -e 's/libcurl //' | $AWK 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
|
||||
if test "$curl_version" -ge 7010005; then
|
||||
AC_MSG_RESULT($curl_version_full)
|
||||
CURL_LIBS=`$CURL_CONFIG --libs`
|
||||
else
|
||||
AC_MSG_ERROR(cURL version 7.10.5 or later is required to compile php with cURL support)
|
||||
fi
|
||||
dnl common stuff (pkg-config / curl-config)
|
||||
|
||||
if test -z "$CURL_MULTIARCH_INCLUDE"; then
|
||||
PHP_ADD_INCLUDE($CURL_DIR/include)
|
||||
else
|
||||
PHP_ADD_INCLUDE($CURL_MULTIARCH_INCLUDE)
|
||||
fi
|
||||
PHP_EVAL_LIBLINE($CURL_LIBS, CURL_SHARED_LIBADD)
|
||||
PHP_ADD_LIBRARY_WITH_PATH(curl, $CURL_DIR/$PHP_LIBDIR, CURL_SHARED_LIBADD)
|
||||
PHP_EVAL_INCLINE($CURL_INCL, CURL_SHARED_LIBADD)
|
||||
|
||||
AC_MSG_CHECKING([for SSL support in libcurl])
|
||||
CURL_SSL=`$CURL_CONFIG --feature | $EGREP SSL`
|
||||
if test "$CURL_SSL" = "SSL"; then
|
||||
if test -n "$CURL_SSL"; then
|
||||
AC_MSG_RESULT([yes])
|
||||
AC_DEFINE([HAVE_CURL_SSL], [1], [Have cURL with SSL support])
|
||||
|
||||
save_CFLAGS="$CFLAGS"
|
||||
CFLAGS="`$CURL_CONFIG --cflags`"
|
||||
CFLAGS=$CURL_INCL
|
||||
save_LDFLAGS="$LDFLAGS"
|
||||
LDFLAGS=$CURL_LIBS
|
||||
|
||||
AC_PROG_CPP
|
||||
AC_MSG_CHECKING([for openssl support in libcurl])
|
||||
@@ -132,6 +160,7 @@ int main(int argc, char *argv[])
|
||||
])
|
||||
|
||||
CFLAGS="$save_CFLAGS"
|
||||
LDFLAGS="$save_LDFLAGS"
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
@@ -142,21 +171,21 @@ int main(int argc, char *argv[])
|
||||
],[
|
||||
AC_MSG_ERROR(There is something wrong. Please check config.log for more information.)
|
||||
],[
|
||||
$CURL_LIBS -L$CURL_DIR/$PHP_LIBDIR
|
||||
$CURL_LIBS
|
||||
])
|
||||
|
||||
PHP_CHECK_LIBRARY(curl,curl_easy_strerror,
|
||||
[
|
||||
AC_DEFINE(HAVE_CURL_EASY_STRERROR,1,[ ])
|
||||
],[],[
|
||||
$CURL_LIBS -L$CURL_DIR/$PHP_LIBDIR
|
||||
$CURL_LIBS
|
||||
])
|
||||
|
||||
PHP_CHECK_LIBRARY(curl,curl_multi_strerror,
|
||||
[
|
||||
AC_DEFINE(HAVE_CURL_MULTI_STRERROR,1,[ ])
|
||||
],[],[
|
||||
$CURL_LIBS -L$CURL_DIR/$PHP_LIBDIR
|
||||
$CURL_LIBS
|
||||
])
|
||||
|
||||
PHP_NEW_EXTENSION(curl, interface.c multi.c share.c curl_file.c, $ext_shared)
|
||||
|
||||
+1
-1
@@ -20,5 +20,5 @@ tl_config.WriteLine("#define timelib_strdup estrdup");
|
||||
tl_config.WriteLine("#define timelib_free efree");
|
||||
tl_config.Close();
|
||||
|
||||
PHP_INSTALL_HEADERS("ext/date/", "php_date.h lib/timelib.h lib/timelib_structs.h lib/timelib_config.h");
|
||||
PHP_INSTALL_HEADERS("ext/date/", "php_date.h lib/timelib.h lib/timelib_config.h");
|
||||
AC_DEFINE('HAVE_TIMELIB_CONFIG_H', 1, 'Have timelib_config.h')
|
||||
+1
-1
@@ -14,7 +14,7 @@ PHP_ADD_BUILD_DIR([$ext_builddir/lib], 1)
|
||||
PHP_ADD_INCLUDE([$ext_builddir/lib])
|
||||
PHP_ADD_INCLUDE([$ext_srcdir/lib])
|
||||
|
||||
PHP_INSTALL_HEADERS([ext/date], [php_date.h lib/timelib.h lib/timelib_structs.h lib/timelib_config.h])
|
||||
PHP_INSTALL_HEADERS([ext/date], [php_date.h lib/timelib.h lib/timelib_config.h])
|
||||
AC_DEFINE([HAVE_TIMELIB_CONFIG_H], [1], [Have timelib_config.h])
|
||||
|
||||
cat > $ext_builddir/lib/timelib_config.h <<EOF
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Derick Rethans
|
||||
Copyright (c) 2015-2017 Derick Rethans
|
||||
Copyright (c) 2017 MongoDB, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
+15
-10
@@ -26,15 +26,15 @@
|
||||
| Schlyter, who wrote this in December 1992 |
|
||||
*/
|
||||
|
||||
#include "timelib.h"
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include "timelib.h"
|
||||
|
||||
#define days_since_2000_Jan_0(y,m,d) \
|
||||
(367L*(y)-((7*((y)+(((m)+9)/12)))/4)+((275*(m))/9)+(d)-730530L)
|
||||
|
||||
#ifndef PI
|
||||
#define PI 3.1415926535897932384
|
||||
# define PI 3.1415926535897932384
|
||||
#endif
|
||||
|
||||
#define RADEG ( 180.0 / PI )
|
||||
@@ -230,7 +230,8 @@ int timelib_astro_rise_set_altitude(timelib_time *t_loc, double lon, double lat,
|
||||
t_loc->i = t_loc->s = 0;
|
||||
timelib_update_ts(t_loc, NULL);
|
||||
|
||||
/* Calculate TS belonging to UTC 00:00 of the current day */
|
||||
/* Calculate TS belonging to UTC 00:00 of the current day, for input into
|
||||
* the algorithm */
|
||||
t_utc = timelib_time_ctor();
|
||||
t_utc->y = t_loc->y;
|
||||
t_utc->m = t_loc->m;
|
||||
@@ -239,8 +240,8 @@ int timelib_astro_rise_set_altitude(timelib_time *t_loc, double lon, double lat,
|
||||
timelib_update_ts(t_utc, NULL);
|
||||
|
||||
/* Compute d of 12h local mean solar time */
|
||||
timestamp = t_loc->sse;
|
||||
d = timelib_ts_to_juliandate(timestamp) - lon/360.0;
|
||||
timestamp = t_utc->sse;
|
||||
d = timelib_ts_to_j2000(timestamp) + 2 - lon/360.0;
|
||||
|
||||
/* Compute local sidereal time of this moment */
|
||||
sidtime = astro_revolution(astro_GMST0(d) + 180.0 + lon);
|
||||
@@ -295,14 +296,18 @@ int timelib_astro_rise_set_altitude(timelib_time *t_loc, double lon, double lat,
|
||||
return rc;
|
||||
}
|
||||
|
||||
double timelib_ts_to_juliandate(timelib_sll ts)
|
||||
double timelib_ts_to_julianday(timelib_sll ts)
|
||||
{
|
||||
double tmp;
|
||||
|
||||
tmp = ts;
|
||||
tmp /= 86400;
|
||||
tmp += 2440587.5;
|
||||
tmp -= 2451543;
|
||||
tmp = (double) ts;
|
||||
tmp /= (double) 86400;
|
||||
tmp += (double) 2440587.5;
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
double timelib_ts_to_j2000(timelib_sll ts)
|
||||
{
|
||||
return timelib_ts_to_julianday(ts) - 2451545;
|
||||
}
|
||||
+58
-3
@@ -23,6 +23,7 @@
|
||||
*/
|
||||
|
||||
#include "timelib.h"
|
||||
#include "timelib_private.h"
|
||||
|
||||
static int m_table_common[13] = { -1, 0, 3, 3, 6, 1, 4, 6, 2, 5, 0, 3, 5 }; /* 1 = jan */
|
||||
static int m_table_leap[13] = { -1, 6, 2, 3, 6, 1, 4, 6, 2, 5, 0, 3, 5 }; /* 1 = jan */
|
||||
@@ -137,17 +138,71 @@ void timelib_isoweek_from_date(timelib_sll y, timelib_sll m, timelib_sll d, time
|
||||
}
|
||||
}
|
||||
|
||||
timelib_sll timelib_daynr_from_weeknr(timelib_sll y, timelib_sll w, timelib_sll d)
|
||||
void timelib_isodate_from_date(timelib_sll y, timelib_sll m, timelib_sll d, timelib_sll *iy, timelib_sll *iw, timelib_sll *id)
|
||||
{
|
||||
timelib_isoweek_from_date(y, m, d, iw, iy);
|
||||
*id = timelib_day_of_week_ex(y, m, d, 1);
|
||||
}
|
||||
|
||||
static timelib_sll timelib_daynr_from_weeknr_ex(timelib_sll iy, timelib_sll iw, timelib_sll id, timelib_sll *y)
|
||||
{
|
||||
timelib_sll dow, day;
|
||||
|
||||
/* Figure out the dayofweek for y-1-1 */
|
||||
dow = timelib_day_of_week(y, 1, 1);
|
||||
dow = timelib_day_of_week(iy, 1, 1);
|
||||
/* then use that to figure out the offset for day 1 of week 1 */
|
||||
day = 0 - (dow > 4 ? dow - 7 : dow);
|
||||
/* and adjust the year to the natural year if we need to */
|
||||
*y = (iw == 1 && day < 0 && id < dow) ? iy - 1 : iy;
|
||||
|
||||
/* Add weeks and days */
|
||||
return day + ((w - 1) * 7) + d;
|
||||
return day + ((iw - 1) * 7) + id;
|
||||
}
|
||||
|
||||
timelib_sll timelib_daynr_from_weeknr(timelib_sll iy, timelib_sll iw, timelib_sll id)
|
||||
{
|
||||
timelib_sll dummy_iso_year;
|
||||
|
||||
return timelib_daynr_from_weeknr_ex(iy, iw, id, &dummy_iso_year);
|
||||
}
|
||||
|
||||
void timelib_date_from_isodate(timelib_sll iy, timelib_sll iw, timelib_sll id, timelib_sll *y, timelib_sll *m, timelib_sll *d)
|
||||
{
|
||||
timelib_sll daynr = timelib_daynr_from_weeknr_ex(iy, iw, id, y) + 1;
|
||||
int *table;
|
||||
|
||||
*m = 0;
|
||||
|
||||
if (daynr <= 0) {
|
||||
*y += 1;
|
||||
}
|
||||
|
||||
if (timelib_is_leap(*y)) {
|
||||
table = ml_table_leap;
|
||||
if (daynr > 366) {
|
||||
*y += 1;
|
||||
daynr -= 366;
|
||||
}
|
||||
} else {
|
||||
table = ml_table_common;
|
||||
if (daynr > 365) {
|
||||
*y += 1;
|
||||
daynr -= 365;
|
||||
}
|
||||
}
|
||||
|
||||
do {
|
||||
daynr -= table[*m];
|
||||
(*m)++;
|
||||
} while (daynr > table[*m]);
|
||||
|
||||
if (daynr <= 0) {
|
||||
daynr += 31;
|
||||
*y -= 1;
|
||||
*m = 12;
|
||||
}
|
||||
|
||||
*d = daynr;
|
||||
}
|
||||
|
||||
int timelib_valid_time(timelib_sll h, timelib_sll i, timelib_sll s)
|
||||
|
||||
+42
-42
@@ -1,42 +1,42 @@
|
||||
{ "sst", 0, -660, "Pacific/Apia" },
|
||||
{ "hst", 0, -600, "Pacific/Honolulu" },
|
||||
{ "akst", 0, -540, "America/Anchorage" },
|
||||
{ "akdt", 1, -480, "America/Anchorage" },
|
||||
{ "pst", 0, -480, "America/Los_Angeles" },
|
||||
{ "pdt", 1, -420, "America/Los_Angeles" },
|
||||
{ "mst", 0, -420, "America/Denver" },
|
||||
{ "mdt", 1, -360, "America/Denver" },
|
||||
{ "cst", 0, -360, "America/Chicago" },
|
||||
{ "cdt", 1, -300, "America/Chicago" },
|
||||
{ "est", 0, -300, "America/New_York" },
|
||||
{ "vet", 0, -270, "America/Caracas" },
|
||||
{ "edt", 1, -240, "America/New_York" },
|
||||
{ "ast", 0, -240, "America/Halifax" },
|
||||
{ "adt", 1, -180, "America/Halifax" },
|
||||
{ "brt", 0, -180, "America/Sao_Paulo" },
|
||||
{ "brst", 1, -120, "America/Sao_Paulo" },
|
||||
{ "azost", 0, -60, "Atlantic/Azores" },
|
||||
{ "azodt", 1, 0, "Atlantic/Azores" },
|
||||
{ "gmt", 0, 0, "Europe/London" },
|
||||
{ "bst", 1, 60, "Europe/London" },
|
||||
{ "cet", 0, 60, "Europe/Paris" },
|
||||
{ "cest", 1, 120, "Europe/Paris" },
|
||||
{ "eet", 0, 120, "Europe/Helsinki" },
|
||||
{ "eest", 1, 180, "Europe/Helsinki" },
|
||||
{ "msk", 0, 180, "Europe/Moscow" },
|
||||
{ "msd", 1, 240, "Europe/Moscow" },
|
||||
{ "gst", 0, 240, "Asia/Dubai" },
|
||||
{ "pkt", 0, 300, "Asia/Karachi" },
|
||||
{ "ist", 0, 330, "Asia/Kolkata" },
|
||||
{ "npt", 0, 345, "Asia/Katmandu" },
|
||||
{ "yekt", 1, 360, "Asia/Yekaterinburg" },
|
||||
{ "novst", 1, 420, "Asia/Novosibirsk" },
|
||||
{ "krat", 0, 420, "Asia/Krasnoyarsk" },
|
||||
{ "cst", 0, 480, "Asia/Shanghai" },
|
||||
{ "krast", 1, 480, "Asia/Krasnoyarsk" },
|
||||
{ "jst", 0, 540, "Asia/Tokyo" },
|
||||
{ "est", 0, 600, "Australia/Melbourne" },
|
||||
{ "cst", 1, 630, "Australia/Adelaide" },
|
||||
{ "est", 1, 660, "Australia/Melbourne" },
|
||||
{ "nzst", 0, 720, "Pacific/Auckland" },
|
||||
{ "nzdt", 1, 780, "Pacific/Auckland" },
|
||||
{ "sst", 0, -660 * 60, "Pacific/Apia" },
|
||||
{ "hst", 0, -600 * 60, "Pacific/Honolulu" },
|
||||
{ "akst", 0, -540 * 60, "America/Anchorage" },
|
||||
{ "akdt", 1, -480 * 60, "America/Anchorage" },
|
||||
{ "pst", 0, -480 * 60, "America/Los_Angeles" },
|
||||
{ "pdt", 1, -420 * 60, "America/Los_Angeles" },
|
||||
{ "mst", 0, -420 * 60, "America/Denver" },
|
||||
{ "mdt", 1, -360 * 60, "America/Denver" },
|
||||
{ "cst", 0, -360 * 60, "America/Chicago" },
|
||||
{ "cdt", 1, -300 * 60, "America/Chicago" },
|
||||
{ "est", 0, -300 * 60, "America/New_York" },
|
||||
{ "vet", 0, -270 * 60, "America/Caracas" },
|
||||
{ "edt", 1, -240 * 60, "America/New_York" },
|
||||
{ "ast", 0, -240 * 60, "America/Halifax" },
|
||||
{ "adt", 1, -180 * 60, "America/Halifax" },
|
||||
{ "brt", 0, -180 * 60, "America/Sao_Paulo" },
|
||||
{ "brst", 1, -120 * 60, "America/Sao_Paulo" },
|
||||
{ "azost", 0, -60 * 60, "Atlantic/Azores" },
|
||||
{ "azodt", 1, 0 * 60, "Atlantic/Azores" },
|
||||
{ "gmt", 0, 0 * 60, "Europe/London" },
|
||||
{ "bst", 1, 60 * 60, "Europe/London" },
|
||||
{ "cet", 0, 60 * 60, "Europe/Paris" },
|
||||
{ "cest", 1, 120 * 60, "Europe/Paris" },
|
||||
{ "eet", 0, 120 * 60, "Europe/Helsinki" },
|
||||
{ "eest", 1, 180 * 60, "Europe/Helsinki" },
|
||||
{ "msk", 0, 180 * 60, "Europe/Moscow" },
|
||||
{ "msd", 1, 240 * 60, "Europe/Moscow" },
|
||||
{ "gst", 0, 240 * 60, "Asia/Dubai" },
|
||||
{ "pkt", 0, 300 * 60, "Asia/Karachi" },
|
||||
{ "ist", 0, 330 * 60, "Asia/Kolkata" },
|
||||
{ "npt", 0, 345 * 60, "Asia/Katmandu" },
|
||||
{ "yekt", 1, 360 * 60, "Asia/Yekaterinburg" },
|
||||
{ "novst", 1, 420 * 60, "Asia/Novosibirsk" },
|
||||
{ "krat", 0, 420 * 60, "Asia/Krasnoyarsk" },
|
||||
{ "cst", 0, 480 * 60, "Asia/Shanghai" },
|
||||
{ "krast", 1, 480 * 60, "Asia/Krasnoyarsk" },
|
||||
{ "jst", 0, 540 * 60, "Asia/Tokyo" },
|
||||
{ "est", 0, 600 * 60, "Australia/Melbourne" },
|
||||
{ "cst", 1, 630 * 60, "Australia/Adelaide" },
|
||||
{ "est", 1, 660 * 60, "Australia/Melbourne" },
|
||||
{ "nzst", 0, 720 * 60, "Pacific/Auckland" },
|
||||
{ "nzdt", 1, 780 * 60, "Pacific/Auckland" },
|
||||
@@ -23,6 +23,7 @@
|
||||
*/
|
||||
|
||||
#include "timelib.h"
|
||||
#include "timelib_private.h"
|
||||
#include <math.h>
|
||||
|
||||
timelib_rel_time *timelib_diff(timelib_time *one, timelib_time *two)
|
||||
@@ -65,7 +66,7 @@ timelib_rel_time *timelib_diff(timelib_time *one, timelib_time *two)
|
||||
rt->h = two->h - one->h;
|
||||
rt->i = two->i - one->i;
|
||||
rt->s = two->s - one->s;
|
||||
rt->f = two->f - one->f;
|
||||
rt->us = two->us - one->us;
|
||||
if (one_backup.dst == 0 && two_backup.dst == 1 && two->sse >= one->sse + 86400 - dst_corr) {
|
||||
rt->h += dst_h_corr;
|
||||
rt->i += dst_m_corr;
|
||||
@@ -99,19 +100,19 @@ timelib_time *timelib_add(timelib_time *old_time, timelib_rel_time *interval)
|
||||
timelib_time *t = timelib_time_clone(old_time);
|
||||
|
||||
if (interval->have_weekday_relative || interval->have_special_relative) {
|
||||
memcpy(&t->relative, interval, sizeof(struct timelib_rel_time));
|
||||
memcpy(&t->relative, interval, sizeof(timelib_rel_time));
|
||||
} else {
|
||||
if (interval->invert) {
|
||||
bias = -1;
|
||||
}
|
||||
memset(&t->relative, 0, sizeof(struct timelib_rel_time));
|
||||
memset(&t->relative, 0, sizeof(timelib_rel_time));
|
||||
t->relative.y = interval->y * bias;
|
||||
t->relative.m = interval->m * bias;
|
||||
t->relative.d = interval->d * bias;
|
||||
t->relative.h = interval->h * bias;
|
||||
t->relative.i = interval->i * bias;
|
||||
t->relative.s = interval->s * bias;
|
||||
t->relative.f = interval->f * bias;
|
||||
t->relative.us = interval->us * bias;
|
||||
}
|
||||
t->have_relative = 1;
|
||||
t->sse_uptodate = 0;
|
||||
@@ -140,14 +141,14 @@ timelib_time *timelib_sub(timelib_time *old_time, timelib_rel_time *interval)
|
||||
bias = -1;
|
||||
}
|
||||
|
||||
memset(&t->relative, 0, sizeof(struct timelib_rel_time));
|
||||
memset(&t->relative, 0, sizeof(timelib_rel_time));
|
||||
t->relative.y = 0 - (interval->y * bias);
|
||||
t->relative.m = 0 - (interval->m * bias);
|
||||
t->relative.d = 0 - (interval->d * bias);
|
||||
t->relative.h = 0 - (interval->h * bias);
|
||||
t->relative.i = 0 - (interval->i * bias);
|
||||
t->relative.s = 0 - (interval->s * bias);
|
||||
t->relative.f = 0 - (interval->f * bias);
|
||||
t->relative.us = 0 - (interval->us * bias);
|
||||
t->have_relative = 1;
|
||||
t->sse_uptodate = 0;
|
||||
|
||||
|
||||
+2668
-1007
File diff suppressed because it is too large.
Load diff
+134
-118
@@ -25,21 +25,12 @@
|
||||
/* $Id$ */
|
||||
|
||||
#include "timelib.h"
|
||||
#include "timelib_private.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <math.h>
|
||||
#include <assert.h>
|
||||
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#else
|
||||
#include <strings.h>
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# define strtoll(s, f, b) _atoi64(s)
|
||||
#elif !defined(HAVE_STRTOLL)
|
||||
@@ -50,18 +41,6 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#define TIMELIB_UNSET -99999
|
||||
|
||||
#define TIMELIB_SECOND 1
|
||||
#define TIMELIB_MINUTE 2
|
||||
#define TIMELIB_HOUR 3
|
||||
#define TIMELIB_DAY 4
|
||||
#define TIMELIB_MONTH 5
|
||||
#define TIMELIB_YEAR 6
|
||||
#define TIMELIB_WEEKDAY 7
|
||||
#define TIMELIB_SPECIAL 8
|
||||
#define TIMELIB_MICROSEC 9
|
||||
|
||||
#define EOI 257
|
||||
#define TIME 258
|
||||
#define DATE 259
|
||||
@@ -113,14 +92,14 @@ typedef unsigned char uchar;
|
||||
|
||||
#define timelib_string_free timelib_free
|
||||
|
||||
#define TIMELIB_HAVE_TIME() { if (s->time->have_time) { add_error(s, "Double time specification"); timelib_string_free(str); return TIMELIB_ERROR; } else { s->time->have_time = 1; s->time->h = 0; s->time->i = 0; s->time->s = 0; s->time->f = 0; } }
|
||||
#define TIMELIB_UNHAVE_TIME() { s->time->have_time = 0; s->time->h = 0; s->time->i = 0; s->time->s = 0; s->time->f = 0; }
|
||||
#define TIMELIB_HAVE_DATE() { if (s->time->have_date) { add_error(s, "Double date specification"); timelib_string_free(str); return TIMELIB_ERROR; } else { s->time->have_date = 1; } }
|
||||
#define TIMELIB_HAVE_TIME() { if (s->time->have_time) { add_error(s, TIMELIB_ERR_DOUBLE_TIME, "Double time specification"); timelib_string_free(str); return TIMELIB_ERROR; } else { s->time->have_time = 1; s->time->h = 0; s->time->i = 0; s->time->s = 0; s->time->us = 0; } }
|
||||
#define TIMELIB_UNHAVE_TIME() { s->time->have_time = 0; s->time->h = 0; s->time->i = 0; s->time->s = 0; s->time->us = 0; }
|
||||
#define TIMELIB_HAVE_DATE() { if (s->time->have_date) { add_error(s, TIMELIB_ERR_DOUBLE_DATE, "Double date specification"); timelib_string_free(str); return TIMELIB_ERROR; } else { s->time->have_date = 1; } }
|
||||
#define TIMELIB_UNHAVE_DATE() { s->time->have_date = 0; s->time->d = 0; s->time->m = 0; s->time->y = 0; }
|
||||
#define TIMELIB_HAVE_RELATIVE() { s->time->have_relative = 1; }
|
||||
#define TIMELIB_HAVE_WEEKDAY_RELATIVE() { s->time->have_relative = 1; s->time->relative.have_weekday_relative = 1; }
|
||||
#define TIMELIB_HAVE_SPECIAL_RELATIVE() { s->time->have_relative = 1; s->time->relative.have_special_relative = 1; }
|
||||
#define TIMELIB_HAVE_TZ() { s->cur = cursor; if (s->time->have_zone) { s->time->have_zone > 1 ? add_error(s, "Double timezone specification") : add_warning(s, "Double timezone specification"); timelib_string_free(str); s->time->have_zone++; return TIMELIB_ERROR; } else { s->time->have_zone++; } }
|
||||
#define TIMELIB_HAVE_TZ() { s->cur = cursor; if (s->time->have_zone) { s->time->have_zone > 1 ? add_error(s, TIMELIB_ERR_DOUBLE_TZ, "Double timezone specification") : add_warning(s, TIMELIB_WARN_DOUBLE_TZ, "Double timezone specification"); timelib_string_free(str); s->time->have_zone++; return TIMELIB_ERROR; } else { s->time->have_zone++; } }
|
||||
|
||||
#define TIMELIB_INIT s->cur = cursor; str = timelib_string(s); ptr = str
|
||||
#define TIMELIB_DEINIT timelib_string_free(str)
|
||||
@@ -146,20 +125,18 @@ typedef unsigned char uchar;
|
||||
#define YYDEBUG(s,c)
|
||||
#endif
|
||||
|
||||
#include "timelib_structs.h"
|
||||
|
||||
typedef struct timelib_elems {
|
||||
typedef struct _timelib_elems {
|
||||
unsigned int c; /* Number of elements */
|
||||
char **v; /* Values */
|
||||
} timelib_elems;
|
||||
|
||||
typedef struct Scanner {
|
||||
typedef struct _Scanner {
|
||||
int fd;
|
||||
uchar *lim, *str, *ptr, *cur, *tok, *pos;
|
||||
unsigned int line, len;
|
||||
struct timelib_error_container *errors;
|
||||
timelib_error_container *errors;
|
||||
|
||||
struct timelib_time *time;
|
||||
timelib_time *time;
|
||||
const timelib_tzdb *tzdb;
|
||||
} Scanner;
|
||||
|
||||
@@ -176,17 +153,17 @@ typedef struct _timelib_relunit {
|
||||
} timelib_relunit;
|
||||
|
||||
/* The timezone table. */
|
||||
const static timelib_tz_lookup_table timelib_timezone_lookup[] = {
|
||||
static const timelib_tz_lookup_table timelib_timezone_lookup[] = {
|
||||
#include "timezonemap.h"
|
||||
{ NULL, 0, 0, NULL },
|
||||
};
|
||||
|
||||
const static timelib_tz_lookup_table timelib_timezone_fallbackmap[] = {
|
||||
static const timelib_tz_lookup_table timelib_timezone_fallbackmap[] = {
|
||||
#include "fallbackmap.h"
|
||||
{ NULL, 0, 0, NULL },
|
||||
};
|
||||
|
||||
const static timelib_tz_lookup_table timelib_timezone_utc[] = {
|
||||
static const timelib_tz_lookup_table timelib_timezone_utc[] = {
|
||||
{ "utc", 0, 0, "UTC" },
|
||||
};
|
||||
|
||||
@@ -355,37 +332,41 @@ uchar *fill(Scanner *s, uchar *cursor){
|
||||
}
|
||||
#endif
|
||||
|
||||
static void add_warning(Scanner *s, char *error)
|
||||
static void add_warning(Scanner *s, int error_code, char *error)
|
||||
{
|
||||
s->errors->warning_count++;
|
||||
s->errors->warning_messages = timelib_realloc(s->errors->warning_messages, s->errors->warning_count * sizeof(timelib_error_message));
|
||||
s->errors->warning_messages[s->errors->warning_count - 1].error_code = error_code;
|
||||
s->errors->warning_messages[s->errors->warning_count - 1].position = s->tok ? s->tok - s->str : 0;
|
||||
s->errors->warning_messages[s->errors->warning_count - 1].character = s->tok ? *s->tok : 0;
|
||||
s->errors->warning_messages[s->errors->warning_count - 1].message = timelib_strdup(error);
|
||||
}
|
||||
|
||||
static void add_error(Scanner *s, char *error)
|
||||
static void add_error(Scanner *s, int error_code, char *error)
|
||||
{
|
||||
s->errors->error_count++;
|
||||
s->errors->error_messages = timelib_realloc(s->errors->error_messages, s->errors->error_count * sizeof(timelib_error_message));
|
||||
s->errors->error_messages[s->errors->error_count - 1].error_code = error_code;
|
||||
s->errors->error_messages[s->errors->error_count - 1].position = s->tok ? s->tok - s->str : 0;
|
||||
s->errors->error_messages[s->errors->error_count - 1].character = s->tok ? *s->tok : 0;
|
||||
s->errors->error_messages[s->errors->error_count - 1].message = timelib_strdup(error);
|
||||
}
|
||||
|
||||
static void add_pbf_warning(Scanner *s, char *error, char *sptr, char *cptr)
|
||||
static void add_pbf_warning(Scanner *s, int error_code, char *error, char *sptr, char *cptr)
|
||||
{
|
||||
s->errors->warning_count++;
|
||||
s->errors->warning_messages = timelib_realloc(s->errors->warning_messages, s->errors->warning_count * sizeof(timelib_error_message));
|
||||
s->errors->warning_messages[s->errors->warning_count - 1].error_code = error_code;
|
||||
s->errors->warning_messages[s->errors->warning_count - 1].position = cptr - sptr;
|
||||
s->errors->warning_messages[s->errors->warning_count - 1].character = *cptr;
|
||||
s->errors->warning_messages[s->errors->warning_count - 1].message = timelib_strdup(error);
|
||||
}
|
||||
|
||||
static void add_pbf_error(Scanner *s, char *error, char *sptr, char *cptr)
|
||||
static void add_pbf_error(Scanner *s, int error_code, char *error, char *sptr, char *cptr)
|
||||
{
|
||||
s->errors->error_count++;
|
||||
s->errors->error_messages = timelib_realloc(s->errors->error_messages, s->errors->error_count * sizeof(timelib_error_message));
|
||||
s->errors->error_messages[s->errors->error_count - 1].error_code = error_code;
|
||||
s->errors->error_messages[s->errors->error_count - 1].position = cptr - sptr;
|
||||
s->errors->error_messages[s->errors->error_count - 1].character = *cptr;
|
||||
s->errors->error_messages[s->errors->error_count - 1].message = timelib_strdup(error);
|
||||
@@ -505,7 +486,7 @@ static void timelib_skip_day_suffix(char **ptr)
|
||||
}
|
||||
}
|
||||
|
||||
static double timelib_get_frac_nr(char **ptr, int max_length)
|
||||
static timelib_sll timelib_get_frac_nr(char **ptr, int max_length)
|
||||
{
|
||||
char *begin, *end, *str;
|
||||
double tmp_nr = TIMELIB_UNSET;
|
||||
@@ -523,12 +504,9 @@ static double timelib_get_frac_nr(char **ptr, int max_length)
|
||||
++len;
|
||||
}
|
||||
end = *ptr;
|
||||
str = timelib_calloc(1, end - begin + 1);
|
||||
memcpy(str, begin, end - begin);
|
||||
if (str[0] == ':') {
|
||||
str[0] = '.';
|
||||
}
|
||||
tmp_nr = strtod(str, NULL);
|
||||
str = timelib_calloc(1, end - begin);
|
||||
memcpy(str, begin + 1, end - begin - 1);
|
||||
tmp_nr = strtod(str, NULL) * pow(10, 7 - (end - begin));
|
||||
timelib_free(str);
|
||||
return tmp_nr;
|
||||
}
|
||||
@@ -668,7 +646,7 @@ static void timelib_set_relative(char **ptr, timelib_sll amount, int behavior, S
|
||||
}
|
||||
|
||||
switch (relunit->unit) {
|
||||
case TIMELIB_MICROSEC: s->time->relative.f += (((double) amount * (double) relunit->multiplier) / 1000000); break;
|
||||
case TIMELIB_MICROSEC: s->time->relative.us += amount * relunit->multiplier; break;
|
||||
case TIMELIB_SECOND: s->time->relative.s += amount * relunit->multiplier; break;
|
||||
case TIMELIB_MINUTE: s->time->relative.i += amount * relunit->multiplier; break;
|
||||
case TIMELIB_HOUR: s->time->relative.h += amount * relunit->multiplier; break;
|
||||
@@ -692,7 +670,7 @@ static void timelib_set_relative(char **ptr, timelib_sll amount, int behavior, S
|
||||
}
|
||||
}
|
||||
|
||||
const static timelib_tz_lookup_table* abbr_search(const char *word, timelib_long gmtoffset, int isdst)
|
||||
static const timelib_tz_lookup_table* abbr_search(const char *word, timelib_long gmtoffset, int isdst)
|
||||
{
|
||||
int first_found = 0;
|
||||
const timelib_tz_lookup_table *tp, *first_found_elem = NULL;
|
||||
@@ -723,7 +701,7 @@ const static timelib_tz_lookup_table* abbr_search(const char *word, timelib_long
|
||||
/* Still didn't find anything, let's find the zone solely based on
|
||||
* offset/isdst then */
|
||||
for (fmp = timelib_timezone_fallbackmap; fmp->name; fmp++) {
|
||||
if ((fmp->gmtoffset * 60) == gmtoffset && fmp->type == isdst) {
|
||||
if (fmp->gmtoffset == gmtoffset && fmp->type == isdst) {
|
||||
return fmp;
|
||||
}
|
||||
}
|
||||
@@ -745,9 +723,9 @@ static timelib_long timelib_lookup_abbr(char **ptr, int *dst, char **tz_abbr, in
|
||||
memcpy(word, begin, end - begin);
|
||||
|
||||
if ((tp = abbr_search(word, -1, 0))) {
|
||||
value = -tp->gmtoffset / 60;
|
||||
value = tp->gmtoffset;
|
||||
*dst = tp->type;
|
||||
value += tp->type * 60;
|
||||
value -= tp->type * 3600;
|
||||
*found = 1;
|
||||
} else {
|
||||
*found = 0;
|
||||
@@ -757,6 +735,42 @@ static timelib_long timelib_lookup_abbr(char **ptr, int *dst, char **tz_abbr, in
|
||||
return value;
|
||||
}
|
||||
|
||||
#define sHOUR(a) (int)(a * 3600)
|
||||
#define sMIN(a) (int)(a * 60)
|
||||
|
||||
static timelib_long timelib_parse_tz_cor(char **ptr)
|
||||
{
|
||||
char *begin = *ptr, *end;
|
||||
timelib_long tmp;
|
||||
|
||||
while (isdigit(**ptr) || **ptr == ':') {
|
||||
++*ptr;
|
||||
}
|
||||
end = *ptr;
|
||||
switch (end - begin) {
|
||||
case 1: /* H */
|
||||
case 2: /* HH */
|
||||
return sHOUR(strtol(begin, NULL, 10));
|
||||
break;
|
||||
case 3: /* H:M */
|
||||
case 4: /* H:MM, HH:M, HHMM */
|
||||
if (begin[1] == ':') {
|
||||
tmp = sHOUR(strtol(begin, NULL, 10)) + sMIN(strtol(begin + 2, NULL, 10));
|
||||
return tmp;
|
||||
} else if (begin[2] == ':') {
|
||||
tmp = sHOUR(strtol(begin, NULL, 10)) + sMIN(strtol(begin + 3, NULL, 10));
|
||||
return tmp;
|
||||
} else {
|
||||
tmp = strtol(begin, NULL, 10);
|
||||
return sHOUR(tmp / 100) + sMIN(tmp % 100);
|
||||
}
|
||||
case 5: /* HH:MM */
|
||||
tmp = sHOUR(strtol(begin, NULL, 10)) + sMIN(strtol(begin + 3, NULL, 10));
|
||||
return tmp;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
timelib_long timelib_parse_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_wrapper)
|
||||
{
|
||||
timelib_tzinfo *res;
|
||||
@@ -777,7 +791,7 @@ timelib_long timelib_parse_zone(char **ptr, int *dst, timelib_time *t, int *tz_n
|
||||
*tz_not_found = 0;
|
||||
t->dst = 0;
|
||||
|
||||
retval = -1 * timelib_parse_tz_cor(ptr);
|
||||
retval = timelib_parse_tz_cor(ptr);
|
||||
} else if (**ptr == '-') {
|
||||
++*ptr;
|
||||
t->is_localtime = 1;
|
||||
@@ -785,7 +799,7 @@ timelib_long timelib_parse_zone(char **ptr, int *dst, timelib_time *t, int *tz_n
|
||||
*tz_not_found = 0;
|
||||
t->dst = 0;
|
||||
|
||||
retval = timelib_parse_tz_cor(ptr);
|
||||
retval = -1 * timelib_parse_tz_cor(ptr);
|
||||
} else {
|
||||
int found = 0;
|
||||
timelib_long offset = 0;
|
||||
@@ -802,7 +816,9 @@ timelib_long timelib_parse_zone(char **ptr, int *dst, timelib_time *t, int *tz_n
|
||||
|
||||
/* Otherwise, we look if we have a TimeZone identifier */
|
||||
if (!found || strcmp("UTC", tz_abbr) == 0) {
|
||||
if ((res = tz_wrapper(tz_abbr, tzdb)) != NULL) {
|
||||
int dummy_error_code;
|
||||
|
||||
if ((res = tz_wrapper(tz_abbr, tzdb, &dummy_error_code)) != NULL) {
|
||||
t->tz_info = res;
|
||||
t->zone_type = TIMELIB_ZONETYPE_ID;
|
||||
found++;
|
||||
@@ -931,8 +947,8 @@ isoweek = year4 "-"? "W" weekofyear;
|
||||
exif = year4 ":" monthlz ":" daylz " " hour24lz ":" minutelz ":" secondlz;
|
||||
firstdayof = 'first day of';
|
||||
lastdayof = 'last day of';
|
||||
backof = 'back of ' hour24 space? meridian?;
|
||||
frontof = 'front of ' hour24 space? meridian?;
|
||||
backof = 'back of ' hour24 (space? meridian)?;
|
||||
frontof = 'front of ' hour24 (space? meridian)?;
|
||||
|
||||
/* Common Log Format: 10/Oct/2000:13:55:36 -0700 */
|
||||
clf = day "/" monthabbr "/" year4 ":" hour24lz ":" minutelz ":" secondlz space tzcorrection;
|
||||
@@ -1036,7 +1052,7 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
|
||||
s->time->m = 1;
|
||||
s->time->d = 1;
|
||||
s->time->h = s->time->i = s->time->s = 0;
|
||||
s->time->f = 0.0;
|
||||
s->time->us = 0;
|
||||
s->time->relative.s += i;
|
||||
s->time->is_localtime = 1;
|
||||
s->time->zone_type = TIMELIB_ZONETYPE_OFFSET;
|
||||
@@ -1049,7 +1065,7 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
|
||||
|
||||
timestampms
|
||||
{
|
||||
timelib_ull i, ms;
|
||||
timelib_ull i, us;
|
||||
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_RELATIVE();
|
||||
@@ -1058,14 +1074,14 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
|
||||
TIMELIB_HAVE_TZ();
|
||||
|
||||
i = timelib_get_unsigned_nr((char **) &ptr, 24);
|
||||
ms = timelib_get_unsigned_nr((char **) &ptr, 24);
|
||||
us = timelib_get_unsigned_nr((char **) &ptr, 24);
|
||||
s->time->y = 1970;
|
||||
s->time->m = 1;
|
||||
s->time->d = 1;
|
||||
s->time->h = s->time->i = s->time->s = 0;
|
||||
s->time->f = 0.0;
|
||||
s->time->us = 0;
|
||||
s->time->relative.s += i;
|
||||
s->time->relative.f = ((double) ms) / 1000000.0;
|
||||
s->time->relative.us = us;
|
||||
s->time->is_localtime = 1;
|
||||
s->time->zone_type = TIMELIB_ZONETYPE_OFFSET;
|
||||
s->time->z = 0;
|
||||
@@ -1165,7 +1181,7 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
|
||||
s->time->s = timelib_get_nr((char **) &ptr, 2);
|
||||
|
||||
if (*ptr == ':' || *ptr == '.') {
|
||||
s->time->f = timelib_get_frac_nr((char **) &ptr, 8);
|
||||
s->time->us = timelib_get_frac_nr((char **) &ptr, 8);
|
||||
}
|
||||
}
|
||||
timelib_eat_spaces((char **) &ptr);
|
||||
@@ -1186,14 +1202,14 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
|
||||
s->time->s = timelib_get_nr((char **) &ptr, 2);
|
||||
|
||||
if (*ptr == '.') {
|
||||
s->time->f = timelib_get_frac_nr((char **) &ptr, 8);
|
||||
s->time->us = timelib_get_frac_nr((char **) &ptr, 8);
|
||||
}
|
||||
}
|
||||
|
||||
if (*ptr != '\0') {
|
||||
s->time->z = timelib_parse_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
if (tz_not_found) {
|
||||
add_error(s, "The timezone could not be found in the database");
|
||||
add_error(s, TIMELIB_ERR_TZID_NOT_FOUND, "The timezone could not be found in the database");
|
||||
}
|
||||
}
|
||||
TIMELIB_DEINIT;
|
||||
@@ -1215,7 +1231,7 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
|
||||
break;
|
||||
default:
|
||||
TIMELIB_DEINIT;
|
||||
add_error(s, "Double time specification");
|
||||
add_error(s, TIMELIB_ERR_DOUBLE_TIME, "Double time specification");
|
||||
return TIMELIB_ERROR;
|
||||
}
|
||||
s->time->have_time++;
|
||||
@@ -1259,7 +1275,7 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
|
||||
if (*ptr != '\0') {
|
||||
s->time->z = timelib_parse_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
if (tz_not_found) {
|
||||
add_error(s, "The timezone could not be found in the database");
|
||||
add_error(s, TIMELIB_ERR_TZID_NOT_FOUND, "The timezone could not be found in the database");
|
||||
}
|
||||
}
|
||||
TIMELIB_DEINIT;
|
||||
@@ -1457,11 +1473,11 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
|
||||
s->time->i = timelib_get_nr((char **) &ptr, 2);
|
||||
s->time->s = timelib_get_nr((char **) &ptr, 2);
|
||||
if (*ptr == '.') {
|
||||
s->time->f = timelib_get_frac_nr((char **) &ptr, 9);
|
||||
s->time->us = timelib_get_frac_nr((char **) &ptr, 9);
|
||||
if (*ptr) { /* timezone is optional */
|
||||
s->time->z = timelib_parse_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
if (tz_not_found) {
|
||||
add_error(s, "The timezone could not be found in the database");
|
||||
add_error(s, TIMELIB_ERR_TZID_NOT_FOUND, "The timezone could not be found in the database");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1564,7 +1580,7 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
|
||||
s->time->s = timelib_get_nr((char **) &ptr, 2);
|
||||
s->time->z = timelib_parse_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
if (tz_not_found) {
|
||||
add_error(s, "The timezone could not be found in the database");
|
||||
add_error(s, TIMELIB_ERR_TZID_NOT_FOUND, "The timezone could not be found in the database");
|
||||
}
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_CLF;
|
||||
@@ -1677,7 +1693,7 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
|
||||
TIMELIB_HAVE_TZ();
|
||||
s->time->z = timelib_parse_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
if (tz_not_found) {
|
||||
add_error(s, "The timezone could not be found in the database");
|
||||
add_error(s, TIMELIB_ERR_TZID_NOT_FOUND, "The timezone could not be found in the database");
|
||||
}
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_TIMEZONE;
|
||||
@@ -1698,7 +1714,7 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
|
||||
s->time->s = timelib_get_nr((char **) &ptr, 2);
|
||||
|
||||
if (*ptr == '.') {
|
||||
s->time->f = timelib_get_frac_nr((char **) &ptr, 8);
|
||||
s->time->us = timelib_get_frac_nr((char **) &ptr, 8);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1723,14 +1739,14 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
|
||||
s->time->s = timelib_get_nr((char **) &ptr, 2);
|
||||
|
||||
if (*ptr == '.') {
|
||||
s->time->f = timelib_get_frac_nr((char **) &ptr, 8);
|
||||
s->time->us = timelib_get_frac_nr((char **) &ptr, 8);
|
||||
}
|
||||
}
|
||||
|
||||
if (*ptr != '\0') {
|
||||
s->time->z = timelib_parse_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
if (tz_not_found) {
|
||||
add_error(s, "The timezone could not be found in the database");
|
||||
add_error(s, TIMELIB_ERR_TZID_NOT_FOUND, "The timezone could not be found in the database");
|
||||
}
|
||||
}
|
||||
TIMELIB_DEINIT;
|
||||
@@ -1766,7 +1782,7 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
|
||||
|
||||
any
|
||||
{
|
||||
add_error(s, "Unexpected character");
|
||||
add_error(s, TIMELIB_ERR_UNEXPECTED_CHARACTER, "Unexpected character");
|
||||
goto std;
|
||||
}
|
||||
*/
|
||||
@@ -1774,14 +1790,14 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
|
||||
|
||||
/*!max:re2c */
|
||||
|
||||
timelib_time* timelib_strtotime(char *s, size_t len, struct timelib_error_container **errors, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_get_wrapper)
|
||||
timelib_time* timelib_strtotime(char *s, size_t len, timelib_error_container **errors, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_get_wrapper)
|
||||
{
|
||||
Scanner in;
|
||||
int t;
|
||||
char *e = s + len - 1;
|
||||
|
||||
memset(&in, 0, sizeof(in));
|
||||
in.errors = timelib_malloc(sizeof(struct timelib_error_container));
|
||||
in.errors = timelib_malloc(sizeof(timelib_error_container));
|
||||
in.errors->warning_count = 0;
|
||||
in.errors->warning_messages = NULL;
|
||||
in.errors->error_count = 0;
|
||||
@@ -1797,13 +1813,13 @@ timelib_time* timelib_strtotime(char *s, size_t len, struct timelib_error_contai
|
||||
}
|
||||
if (e - s < 0) {
|
||||
in.time = timelib_time_ctor();
|
||||
add_error(&in, "Empty string");
|
||||
add_error(&in, TIMELIB_ERR_EMPTY_STRING, "Empty string");
|
||||
if (errors) {
|
||||
*errors = in.errors;
|
||||
} else {
|
||||
timelib_error_container_dtor(in.errors);
|
||||
}
|
||||
in.time->y = in.time->d = in.time->m = in.time->h = in.time->i = in.time->s = in.time->f = in.time->dst = in.time->z = TIMELIB_UNSET;
|
||||
in.time->y = in.time->d = in.time->m = in.time->h = in.time->i = in.time->s = in.time->us = in.time->dst = in.time->z = TIMELIB_UNSET;
|
||||
in.time->is_localtime = in.time->zone_type = 0;
|
||||
return in.time;
|
||||
}
|
||||
@@ -1821,7 +1837,7 @@ timelib_time* timelib_strtotime(char *s, size_t len, struct timelib_error_contai
|
||||
in.time->h = TIMELIB_UNSET;
|
||||
in.time->i = TIMELIB_UNSET;
|
||||
in.time->s = TIMELIB_UNSET;
|
||||
in.time->f = TIMELIB_UNSET;
|
||||
in.time->us = TIMELIB_UNSET;
|
||||
in.time->z = TIMELIB_UNSET;
|
||||
in.time->dst = TIMELIB_UNSET;
|
||||
in.tzdb = tzdb;
|
||||
@@ -1838,11 +1854,11 @@ timelib_time* timelib_strtotime(char *s, size_t len, struct timelib_error_contai
|
||||
|
||||
/* do funky checking whether the parsed time was valid time */
|
||||
if (in.time->have_time && !timelib_valid_time( in.time->h, in.time->i, in.time->s)) {
|
||||
add_warning(&in, "The parsed time was invalid");
|
||||
add_warning(&in, TIMELIB_WARN_INVALID_TIME, "The parsed time was invalid");
|
||||
}
|
||||
/* do funky checking whether the parsed date was valid date */
|
||||
if (in.time->have_date && !timelib_valid_date( in.time->y, in.time->m, in.time->d)) {
|
||||
add_warning(&in, "The parsed date was invalid");
|
||||
add_warning(&in, TIMELIB_WARN_INVALID_DATE, "The parsed date was invalid");
|
||||
}
|
||||
|
||||
timelib_free(in.str);
|
||||
@@ -1857,12 +1873,12 @@ timelib_time* timelib_strtotime(char *s, size_t len, struct timelib_error_contai
|
||||
#define TIMELIB_CHECK_NUMBER \
|
||||
if (strchr("0123456789", *ptr) == NULL) \
|
||||
{ \
|
||||
add_pbf_error(s, "Unexpected data found.", string, begin); \
|
||||
add_pbf_error(s, TIMELIB_ERR_UNEXPECTED_DATA, "Unexpected data found.", string, begin); \
|
||||
}
|
||||
#define TIMELIB_CHECK_SIGNED_NUMBER \
|
||||
if (strchr("-0123456789", *ptr) == NULL) \
|
||||
{ \
|
||||
add_pbf_error(s, "Unexpected data found.", string, begin); \
|
||||
add_pbf_error(s, TIMELIB_ERR_UNEXPECTED_DATA, "Unexpected data found.", string, begin); \
|
||||
}
|
||||
|
||||
static void timelib_time_reset_fields(timelib_time *time)
|
||||
@@ -1873,7 +1889,7 @@ static void timelib_time_reset_fields(timelib_time *time)
|
||||
time->m = 1;
|
||||
time->d = 1;
|
||||
time->h = time->i = time->s = 0;
|
||||
time->f = 0.0;
|
||||
time->us = 0;
|
||||
time->tz_info = NULL;
|
||||
}
|
||||
|
||||
@@ -1887,7 +1903,7 @@ static void timelib_time_reset_unset_fields(timelib_time *time)
|
||||
if (time->h == TIMELIB_UNSET ) time->h = 0;
|
||||
if (time->i == TIMELIB_UNSET ) time->i = 0;
|
||||
if (time->s == TIMELIB_UNSET ) time->s = 0;
|
||||
if (time->f == TIMELIB_UNSET ) time->f = 0.0;
|
||||
if (time->us == TIMELIB_UNSET ) time->us = 0;
|
||||
}
|
||||
|
||||
timelib_time *timelib_parse_from_format(char *format, char *string, size_t len, timelib_error_container **errors, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_get_wrapper)
|
||||
@@ -1901,7 +1917,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, size_t len,
|
||||
int allow_extra = 0;
|
||||
|
||||
memset(&in, 0, sizeof(in));
|
||||
in.errors = timelib_malloc(sizeof(struct timelib_error_container));
|
||||
in.errors = timelib_malloc(sizeof(timelib_error_container));
|
||||
in.errors->warning_count = 0;
|
||||
in.errors->warning_messages = NULL;
|
||||
in.errors->error_count = 0;
|
||||
@@ -1914,7 +1930,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, size_t len,
|
||||
in.time->h = TIMELIB_UNSET;
|
||||
in.time->i = TIMELIB_UNSET;
|
||||
in.time->s = TIMELIB_UNSET;
|
||||
in.time->f = TIMELIB_UNSET;
|
||||
in.time->us = TIMELIB_UNSET;
|
||||
in.time->z = TIMELIB_UNSET;
|
||||
in.time->dst = TIMELIB_UNSET;
|
||||
in.tzdb = tzdb;
|
||||
@@ -1932,7 +1948,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, size_t len,
|
||||
|
||||
tmprel = timelib_lookup_relunit((char **) &ptr);
|
||||
if (!tmprel) {
|
||||
add_pbf_error(s, "A textual day could not be found", string, begin);
|
||||
add_pbf_error(s, TIMELIB_ERR_NO_TEXTUAL_DAY, "A textual day could not be found", string, begin);
|
||||
break;
|
||||
} else {
|
||||
in.time->have_relative = 1;
|
||||
@@ -1946,7 +1962,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, size_t len,
|
||||
case 'j': /* two digit day, without leading zero */
|
||||
TIMELIB_CHECK_NUMBER;
|
||||
if ((s->time->d = timelib_get_nr((char **) &ptr, 2)) == TIMELIB_UNSET) {
|
||||
add_pbf_error(s, "A two digit day could not be found", string, begin);
|
||||
add_pbf_error(s, TIMELIB_ERR_NO_TWO_DIGIT_DAY, "A two digit day could not be found", string, begin);
|
||||
}
|
||||
break;
|
||||
case 'S': /* day suffix, ignored, nor checked */
|
||||
@@ -1955,7 +1971,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, size_t len,
|
||||
case 'z': /* day of year - resets month (0 based) - also initializes everything else to !TIMELIB_UNSET */
|
||||
TIMELIB_CHECK_NUMBER;
|
||||
if ((tmp = timelib_get_nr((char **) &ptr, 3)) == TIMELIB_UNSET) {
|
||||
add_pbf_error(s, "A three digit day-of-year could not be found", string, begin);
|
||||
add_pbf_error(s, TIMELIB_ERR_NO_THREE_DIGIT_DAY_OF_YEAR, "A three digit day-of-year could not be found", string, begin);
|
||||
} else {
|
||||
s->time->m = 1;
|
||||
s->time->d = tmp + 1;
|
||||
@@ -1967,14 +1983,14 @@ timelib_time *timelib_parse_from_format(char *format, char *string, size_t len,
|
||||
case 'n': /* two digit month, without leading zero */
|
||||
TIMELIB_CHECK_NUMBER;
|
||||
if ((s->time->m = timelib_get_nr((char **) &ptr, 2)) == TIMELIB_UNSET) {
|
||||
add_pbf_error(s, "A two digit month could not be found", string, begin);
|
||||
add_pbf_error(s, TIMELIB_ERR_NO_TWO_DIGIT_MONTH, "A two digit month could not be found", string, begin);
|
||||
}
|
||||
break;
|
||||
case 'M': /* three letter month */
|
||||
case 'F': /* full month */
|
||||
tmp = timelib_lookup_month((char **) &ptr);
|
||||
if (!tmp) {
|
||||
add_pbf_error(s, "A textual month could not be found", string, begin);
|
||||
add_pbf_error(s, TIMELIB_ERR_NO_TEXTUAL_MONTH, "A textual month could not be found", string, begin);
|
||||
} else {
|
||||
s->time->m = tmp;
|
||||
}
|
||||
@@ -1984,7 +2000,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, size_t len,
|
||||
int length = 0;
|
||||
TIMELIB_CHECK_NUMBER;
|
||||
if ((s->time->y = timelib_get_nr_ex((char **) &ptr, 2, &length)) == TIMELIB_UNSET) {
|
||||
add_pbf_error(s, "A two digit year could not be found", string, begin);
|
||||
add_pbf_error(s, TIMELIB_ERR_NO_TWO_DIGIT_YEAR, "A two digit year could not be found", string, begin);
|
||||
}
|
||||
TIMELIB_PROCESS_YEAR(s->time->y, length);
|
||||
}
|
||||
@@ -1992,32 +2008,32 @@ timelib_time *timelib_parse_from_format(char *format, char *string, size_t len,
|
||||
case 'Y': /* four digit year */
|
||||
TIMELIB_CHECK_NUMBER;
|
||||
if ((s->time->y = timelib_get_nr((char **) &ptr, 4)) == TIMELIB_UNSET) {
|
||||
add_pbf_error(s, "A four digit year could not be found", string, begin);
|
||||
add_pbf_error(s, TIMELIB_ERR_NO_FOUR_DIGIT_YEAR, "A four digit year could not be found", string, begin);
|
||||
}
|
||||
break;
|
||||
case 'g': /* two digit hour, with leading zero */
|
||||
case 'h': /* two digit hour, without leading zero */
|
||||
TIMELIB_CHECK_NUMBER;
|
||||
if ((s->time->h = timelib_get_nr((char **) &ptr, 2)) == TIMELIB_UNSET) {
|
||||
add_pbf_error(s, "A two digit hour could not be found", string, begin);
|
||||
add_pbf_error(s, TIMELIB_ERR_NO_TWO_DIGIT_HOUR, "A two digit hour could not be found", string, begin);
|
||||
}
|
||||
if (s->time->h > 12) {
|
||||
add_pbf_error(s, "Hour can not be higher than 12", string, begin);
|
||||
add_pbf_error(s, TIMELIB_ERR_HOUR_LARGER_THAN_12, "Hour can not be higher than 12", string, begin);
|
||||
}
|
||||
break;
|
||||
case 'G': /* two digit hour, with leading zero */
|
||||
case 'H': /* two digit hour, without leading zero */
|
||||
TIMELIB_CHECK_NUMBER;
|
||||
if ((s->time->h = timelib_get_nr((char **) &ptr, 2)) == TIMELIB_UNSET) {
|
||||
add_pbf_error(s, "A two digit hour could not be found", string, begin);
|
||||
add_pbf_error(s, TIMELIB_ERR_NO_TWO_DIGIT_HOUR, "A two digit hour could not be found", string, begin);
|
||||
}
|
||||
break;
|
||||
case 'a': /* am/pm/a.m./p.m. */
|
||||
case 'A': /* AM/PM/A.M./P.M. */
|
||||
if (s->time->h == TIMELIB_UNSET) {
|
||||
add_pbf_error(s, "Meridian can only come after an hour has been found", string, begin);
|
||||
add_pbf_error(s, TIMELIB_ERR_MERIDIAN_BEFORE_HOUR, "Meridian can only come after an hour has been found", string, begin);
|
||||
} else if ((tmp = timelib_meridian_with_check((char **) &ptr, s->time->h)) == TIMELIB_UNSET) {
|
||||
add_pbf_error(s, "A meridian could not be found", string, begin);
|
||||
add_pbf_error(s, TIMELIB_ERR_NO_MERIDIAN, "A meridian could not be found", string, begin);
|
||||
} else {
|
||||
s->time->h += tmp;
|
||||
}
|
||||
@@ -2030,7 +2046,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, size_t len,
|
||||
TIMELIB_CHECK_NUMBER;
|
||||
min = timelib_get_nr_ex((char **) &ptr, 2, &length);
|
||||
if (min == TIMELIB_UNSET || length != 2) {
|
||||
add_pbf_error(s, "A two digit minute could not be found", string, begin);
|
||||
add_pbf_error(s, TIMELIB_ERR_NO_TWO_DIGIT_MINUTE, "A two digit minute could not be found", string, begin);
|
||||
} else {
|
||||
s->time->i = min;
|
||||
}
|
||||
@@ -2044,13 +2060,13 @@ timelib_time *timelib_parse_from_format(char *format, char *string, size_t len,
|
||||
TIMELIB_CHECK_NUMBER;
|
||||
sec = timelib_get_nr_ex((char **) &ptr, 2, &length);
|
||||
if (sec == TIMELIB_UNSET || length != 2) {
|
||||
add_pbf_error(s, "A two digit second could not be found", string, begin);
|
||||
add_pbf_error(s, TIMELIB_ERR_NO_TWO_DIGIT_SECOND, "A two digit second could not be found", string, begin);
|
||||
} else {
|
||||
s->time->s = sec;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'u': /* up to six digit millisecond */
|
||||
case 'u': /* up to six digit microsecond */
|
||||
{
|
||||
double f;
|
||||
char *tptr;
|
||||
@@ -2058,9 +2074,9 @@ timelib_time *timelib_parse_from_format(char *format, char *string, size_t len,
|
||||
TIMELIB_CHECK_NUMBER;
|
||||
tptr = ptr;
|
||||
if ((f = timelib_get_nr((char **) &ptr, 6)) == TIMELIB_UNSET || (ptr - tptr < 1)) {
|
||||
add_pbf_error(s, "A six digit millisecond could not be found", string, begin);
|
||||
add_pbf_error(s, TIMELIB_ERR_NO_SIX_DIGIT_MICROSECOND, "A six digit microsecond could not be found", string, begin);
|
||||
} else {
|
||||
s->time->f = (f / pow(10, (ptr - tptr)));
|
||||
s->time->us = (f * pow(10, 6 - (ptr - tptr)));
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -2090,7 +2106,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, size_t len,
|
||||
int tz_not_found;
|
||||
s->time->z = timelib_parse_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
if (tz_not_found) {
|
||||
add_pbf_error(s, "The timezone could not be found in the database", string, begin);
|
||||
add_pbf_error(s, TIMELIB_ERR_TZID_NOT_FOUND, "The timezone could not be found in the database", string, begin);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -2099,7 +2115,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, size_t len,
|
||||
if (*ptr == ';' || *ptr == ':' || *ptr == '/' || *ptr == '.' || *ptr == ',' || *ptr == '-' || *ptr == '(' || *ptr == ')') {
|
||||
++ptr;
|
||||
} else {
|
||||
add_pbf_error(s, "The separation symbol ([;:/.,-]) could not be found", string, begin);
|
||||
add_pbf_error(s, TIMELIB_ERR_NO_SEP_SYMBOL, "The separation symbol ([;:/.,-]) could not be found", string, begin);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -2114,7 +2130,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, size_t len,
|
||||
if (*ptr == *fptr) {
|
||||
++ptr;
|
||||
} else {
|
||||
add_pbf_error(s, "The separation symbol could not be found", string, begin);
|
||||
add_pbf_error(s, TIMELIB_ERR_NO_SEP_SYMBOL, "The separation symbol could not be found", string, begin);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -2132,14 +2148,14 @@ timelib_time *timelib_parse_from_format(char *format, char *string, size_t len,
|
||||
|
||||
case '\\': /* escaped char */
|
||||
if(!fptr[1]) {
|
||||
add_pbf_error(s, "Escaped character expected", string, begin);
|
||||
add_pbf_error(s, TIMELIB_ERR_EXPECTED_ESCAPE_CHAR, "Escaped character expected", string, begin);
|
||||
break;
|
||||
}
|
||||
fptr++;
|
||||
if (*ptr == *fptr) {
|
||||
++ptr;
|
||||
} else {
|
||||
add_pbf_error(s, "The escaped character could not be found", string, begin);
|
||||
add_pbf_error(s, TIMELIB_ERR_NO_ESCAPED_CHAR, "The escaped character could not be found", string, begin);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -2153,7 +2169,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, size_t len,
|
||||
|
||||
default:
|
||||
if (*fptr != *ptr) {
|
||||
add_pbf_error(s, "The format separator does not match", string, begin);
|
||||
add_pbf_error(s, TIMELIB_ERR_WRONG_FORMAT_SEP, "The format separator does not match", string, begin);
|
||||
}
|
||||
ptr++;
|
||||
}
|
||||
@@ -2161,9 +2177,9 @@ timelib_time *timelib_parse_from_format(char *format, char *string, size_t len,
|
||||
}
|
||||
if (*ptr) {
|
||||
if (allow_extra) {
|
||||
add_pbf_warning(s, "Trailing data", string, ptr);
|
||||
add_pbf_warning(s, TIMELIB_WARN_TRAILING_DATA, "Trailing data", string, ptr);
|
||||
} else {
|
||||
add_pbf_error(s, "Trailing data", string, ptr);
|
||||
add_pbf_error(s, TIMELIB_ERR_TRAILING_DATA, "Trailing data", string, ptr);
|
||||
}
|
||||
}
|
||||
/* ignore trailing +'s */
|
||||
@@ -2184,7 +2200,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, size_t len,
|
||||
break;
|
||||
|
||||
default:
|
||||
add_pbf_error(s, "Data missing", string, ptr);
|
||||
add_pbf_error(s, TIMELIB_ERR_DATA_MISSING, "Data missing", string, ptr);
|
||||
done = 1;
|
||||
}
|
||||
}
|
||||
@@ -2207,13 +2223,13 @@ timelib_time *timelib_parse_from_format(char *format, char *string, size_t len,
|
||||
if (s->time->h != TIMELIB_UNSET && s->time->i != TIMELIB_UNSET &&
|
||||
s->time->s != TIMELIB_UNSET &&
|
||||
!timelib_valid_time( s->time->h, s->time->i, s->time->s)) {
|
||||
add_pbf_warning(s, "The parsed time was invalid", string, ptr);
|
||||
add_pbf_warning(s, TIMELIB_WARN_INVALID_TIME, "The parsed time was invalid", string, ptr);
|
||||
}
|
||||
/* do funky checking whether the parsed date was valid date */
|
||||
if (s->time->y != TIMELIB_UNSET && s->time->m != TIMELIB_UNSET &&
|
||||
s->time->d != TIMELIB_UNSET &&
|
||||
!timelib_valid_date( s->time->y, s->time->m, s->time->d)) {
|
||||
add_pbf_warning(s, "The parsed date was invalid", string, ptr);
|
||||
add_pbf_warning(s, TIMELIB_WARN_INVALID_DATE, "The parsed date was invalid", string, ptr);
|
||||
}
|
||||
|
||||
if (errors) {
|
||||
@@ -2230,15 +2246,15 @@ void timelib_fill_holes(timelib_time *parsed, timelib_time *now, int options)
|
||||
parsed->h = 0;
|
||||
parsed->i = 0;
|
||||
parsed->s = 0;
|
||||
parsed->f = 0;
|
||||
parsed->us = 0;
|
||||
}
|
||||
if (
|
||||
parsed->y != TIMELIB_UNSET || parsed->m != TIMELIB_UNSET || parsed->d != TIMELIB_UNSET ||
|
||||
parsed->h != TIMELIB_UNSET || parsed->i != TIMELIB_UNSET || parsed->s != TIMELIB_UNSET
|
||||
) {
|
||||
if (parsed->f == TIMELIB_UNSET) parsed->f = 0;
|
||||
if (parsed->us == TIMELIB_UNSET) parsed->us = 0;
|
||||
} else {
|
||||
if (parsed->f == TIMELIB_UNSET) parsed->f = now->f != TIMELIB_UNSET ? now->f : 0;
|
||||
if (parsed->us == TIMELIB_UNSET) parsed->us = now->us != TIMELIB_UNSET ? now->us : 0;
|
||||
}
|
||||
if (parsed->y == TIMELIB_UNSET) parsed->y = now->y != TIMELIB_UNSET ? now->y : 0;
|
||||
if (parsed->m == TIMELIB_UNSET) parsed->m = now->m != TIMELIB_UNSET ? now->m : 0;
|
||||
|
||||
+162
-141
@@ -1,4 +1,4 @@
|
||||
/* Generated by re2c 0.13.5 on Thu Aug 13 10:30:12 2015 */
|
||||
/* Generated by re2c 0.15.3 on Mon Sep 4 22:44:07 2017 */
|
||||
#line 1 "ext/date/lib/parse_iso_intervals.re"
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
@@ -27,19 +27,10 @@
|
||||
/* $Id$ */
|
||||
|
||||
#include "timelib.h"
|
||||
#include "timelib_private.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#else
|
||||
#include <strings.h>
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# define strtoll(s, f, b) _atoi64(s)
|
||||
#elif !defined(HAVE_STRTOLL)
|
||||
@@ -50,15 +41,6 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#define TIMELIB_UNSET -99999
|
||||
|
||||
#define TIMELIB_SECOND 1
|
||||
#define TIMELIB_MINUTE 2
|
||||
#define TIMELIB_HOUR 3
|
||||
#define TIMELIB_DAY 4
|
||||
#define TIMELIB_MONTH 5
|
||||
#define TIMELIB_YEAR 6
|
||||
|
||||
#define EOI 257
|
||||
|
||||
#define TIMELIB_PERIOD 260
|
||||
@@ -90,18 +72,16 @@ typedef unsigned char uchar;
|
||||
#define YYDEBUG(s,c)
|
||||
#endif
|
||||
|
||||
#include "timelib_structs.h"
|
||||
|
||||
typedef struct Scanner {
|
||||
typedef struct _Scanner {
|
||||
int fd;
|
||||
uchar *lim, *str, *ptr, *cur, *tok, *pos;
|
||||
unsigned int line, len;
|
||||
struct timelib_error_container *errors;
|
||||
timelib_error_container *errors;
|
||||
|
||||
struct timelib_time *begin;
|
||||
struct timelib_time *end;
|
||||
struct timelib_rel_time *period;
|
||||
int recurrences;
|
||||
timelib_time *begin;
|
||||
timelib_time *end;
|
||||
timelib_rel_time *period;
|
||||
int recurrences;
|
||||
|
||||
int have_period;
|
||||
int have_recurrences;
|
||||
@@ -110,15 +90,6 @@ typedef struct Scanner {
|
||||
int have_end_date;
|
||||
} Scanner;
|
||||
|
||||
static void add_warning(Scanner *s, char *error)
|
||||
{
|
||||
s->errors->warning_count++;
|
||||
s->errors->warning_messages = timelib_realloc(s->errors->warning_messages, s->errors->warning_count * sizeof(timelib_error_message));
|
||||
s->errors->warning_messages[s->errors->warning_count - 1].position = s->tok ? s->tok - s->str : 0;
|
||||
s->errors->warning_messages[s->errors->warning_count - 1].character = s->tok ? *s->tok : 0;
|
||||
s->errors->warning_messages[s->errors->warning_count - 1].message = timelib_strdup(error);
|
||||
}
|
||||
|
||||
static void add_error(Scanner *s, char *error)
|
||||
{
|
||||
s->errors->error_count++;
|
||||
@@ -182,55 +153,6 @@ static timelib_ull timelib_get_unsigned_nr(char **ptr, int max_length)
|
||||
return dir * timelib_get_nr(ptr, max_length);
|
||||
}
|
||||
|
||||
static void timelib_eat_spaces(char **ptr)
|
||||
{
|
||||
while (**ptr == ' ' || **ptr == '\t') {
|
||||
++*ptr;
|
||||
}
|
||||
}
|
||||
|
||||
static void timelib_eat_until_separator(char **ptr)
|
||||
{
|
||||
while (strchr(" \t.,:;/-0123456789", **ptr) == NULL) {
|
||||
++*ptr;
|
||||
}
|
||||
}
|
||||
|
||||
static timelib_long timelib_get_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found, const timelib_tzdb *tzdb)
|
||||
{
|
||||
timelib_long retval = 0;
|
||||
|
||||
*tz_not_found = 0;
|
||||
|
||||
while (**ptr == ' ' || **ptr == '\t' || **ptr == '(') {
|
||||
++*ptr;
|
||||
}
|
||||
if ((*ptr)[0] == 'G' && (*ptr)[1] == 'M' && (*ptr)[2] == 'T' && ((*ptr)[3] == '+' || (*ptr)[3] == '-')) {
|
||||
*ptr += 3;
|
||||
}
|
||||
if (**ptr == '+') {
|
||||
++*ptr;
|
||||
t->is_localtime = 1;
|
||||
t->zone_type = TIMELIB_ZONETYPE_OFFSET;
|
||||
*tz_not_found = 0;
|
||||
t->dst = 0;
|
||||
|
||||
retval = -1 * timelib_parse_tz_cor(ptr);
|
||||
} else if (**ptr == '-') {
|
||||
++*ptr;
|
||||
t->is_localtime = 1;
|
||||
t->zone_type = TIMELIB_ZONETYPE_OFFSET;
|
||||
*tz_not_found = 0;
|
||||
t->dst = 0;
|
||||
|
||||
retval = timelib_parse_tz_cor(ptr);
|
||||
}
|
||||
while (**ptr == ')') {
|
||||
++*ptr;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
#define timelib_split_free(arg) { \
|
||||
int i; \
|
||||
for (i = 0; i < arg.c; i++) { \
|
||||
@@ -254,49 +176,49 @@ static int scan(Scanner *s)
|
||||
std:
|
||||
s->tok = cursor;
|
||||
s->len = 0;
|
||||
#line 282 "ext/date/lib/parse_iso_intervals.re"
|
||||
#line 204 "ext/date/lib/parse_iso_intervals.re"
|
||||
|
||||
|
||||
|
||||
#line 262 "ext/date/lib/parse_iso_intervals.c"
|
||||
#line 184 "<stdout>"
|
||||
{
|
||||
YYCTYPE yych;
|
||||
unsigned int yyaccept = 0;
|
||||
static const unsigned char yybm[] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
128, 128, 128, 128, 128, 128, 128, 128,
|
||||
128, 128, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
128, 128, 128, 128, 128, 128, 128, 128,
|
||||
128, 128, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
};
|
||||
|
||||
YYDEBUG(0, *YYCURSOR);
|
||||
if ((YYLIMIT - YYCURSOR) < 20) YYFILL(20);
|
||||
yych = *YYCURSOR;
|
||||
if (yych <= ',') {
|
||||
@@ -321,30 +243,35 @@ std:
|
||||
if (yych != 'R') goto yy11;
|
||||
}
|
||||
}
|
||||
YYDEBUG(2, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
if ((yych = *YYCURSOR) <= '/') goto yy3;
|
||||
if (yych <= '9') goto yy98;
|
||||
yy3:
|
||||
#line 395 "ext/date/lib/parse_iso_intervals.re"
|
||||
YYDEBUG(3, *YYCURSOR);
|
||||
#line 317 "ext/date/lib/parse_iso_intervals.re"
|
||||
{
|
||||
add_error(s, "Unexpected character");
|
||||
goto std;
|
||||
}
|
||||
#line 334 "ext/date/lib/parse_iso_intervals.c"
|
||||
#line 258 "<stdout>"
|
||||
yy4:
|
||||
YYDEBUG(4, *YYCURSOR);
|
||||
yyaccept = 0;
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
if (yych <= '/') goto yy3;
|
||||
if (yych <= '9') goto yy59;
|
||||
goto yy3;
|
||||
yy5:
|
||||
YYDEBUG(5, *YYCURSOR);
|
||||
yyaccept = 1;
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
if (yych <= '/') goto yy6;
|
||||
if (yych <= '9') goto yy12;
|
||||
if (yych == 'T') goto yy14;
|
||||
yy6:
|
||||
#line 322 "ext/date/lib/parse_iso_intervals.re"
|
||||
YYDEBUG(6, *YYCURSOR);
|
||||
#line 244 "ext/date/lib/parse_iso_intervals.re"
|
||||
{
|
||||
timelib_sll nr;
|
||||
int in_time = 0;
|
||||
@@ -385,26 +312,32 @@ yy6:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_PERIOD;
|
||||
}
|
||||
#line 389 "ext/date/lib/parse_iso_intervals.c"
|
||||
#line 316 "<stdout>"
|
||||
yy7:
|
||||
YYDEBUG(7, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
#line 384 "ext/date/lib/parse_iso_intervals.re"
|
||||
YYDEBUG(8, *YYCURSOR);
|
||||
#line 306 "ext/date/lib/parse_iso_intervals.re"
|
||||
{
|
||||
goto std;
|
||||
}
|
||||
#line 396 "ext/date/lib/parse_iso_intervals.c"
|
||||
#line 325 "<stdout>"
|
||||
yy9:
|
||||
YYDEBUG(9, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
#line 389 "ext/date/lib/parse_iso_intervals.re"
|
||||
YYDEBUG(10, *YYCURSOR);
|
||||
#line 311 "ext/date/lib/parse_iso_intervals.re"
|
||||
{
|
||||
s->pos = cursor; s->line++;
|
||||
goto std;
|
||||
}
|
||||
#line 404 "ext/date/lib/parse_iso_intervals.c"
|
||||
#line 335 "<stdout>"
|
||||
yy11:
|
||||
YYDEBUG(11, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
goto yy3;
|
||||
yy12:
|
||||
YYDEBUG(12, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= 'L') {
|
||||
if (yych <= '9') {
|
||||
@@ -421,13 +354,15 @@ yy12:
|
||||
}
|
||||
}
|
||||
yy13:
|
||||
YYDEBUG(13, *YYCURSOR);
|
||||
YYCURSOR = YYMARKER;
|
||||
if (yyaccept <= 0) {
|
||||
if (yyaccept == 0) {
|
||||
goto yy3;
|
||||
} else {
|
||||
goto yy6;
|
||||
}
|
||||
yy14:
|
||||
YYDEBUG(14, *YYCURSOR);
|
||||
yyaccept = 1;
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
if (yybm[0+yych] & 128) {
|
||||
@@ -435,9 +370,11 @@ yy14:
|
||||
}
|
||||
goto yy6;
|
||||
yy15:
|
||||
YYDEBUG(15, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
|
||||
yych = *YYCURSOR;
|
||||
YYDEBUG(16, *YYCURSOR);
|
||||
if (yybm[0+yych] & 128) {
|
||||
goto yy15;
|
||||
}
|
||||
@@ -449,23 +386,28 @@ yy15:
|
||||
if (yych != 'S') goto yy13;
|
||||
}
|
||||
yy17:
|
||||
YYDEBUG(17, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
goto yy6;
|
||||
yy18:
|
||||
YYDEBUG(18, *YYCURSOR);
|
||||
yyaccept = 1;
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
if (yych <= '/') goto yy6;
|
||||
if (yych <= '9') goto yy22;
|
||||
goto yy6;
|
||||
yy19:
|
||||
YYDEBUG(19, *YYCURSOR);
|
||||
yyaccept = 1;
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
if (yych <= '/') goto yy6;
|
||||
if (yych >= ':') goto yy6;
|
||||
yy20:
|
||||
YYDEBUG(20, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
|
||||
yych = *YYCURSOR;
|
||||
YYDEBUG(21, *YYCURSOR);
|
||||
if (yych <= 'L') {
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych <= '9') goto yy20;
|
||||
@@ -476,18 +418,22 @@ yy20:
|
||||
goto yy13;
|
||||
}
|
||||
yy22:
|
||||
YYDEBUG(22, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
if (YYLIMIT <= YYCURSOR) YYFILL(1);
|
||||
yych = *YYCURSOR;
|
||||
YYDEBUG(23, *YYCURSOR);
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych <= '9') goto yy22;
|
||||
if (yych == 'S') goto yy17;
|
||||
goto yy13;
|
||||
yy24:
|
||||
YYDEBUG(24, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych == 'T') goto yy14;
|
||||
goto yy6;
|
||||
yy25:
|
||||
YYDEBUG(25, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= 'L') {
|
||||
if (yych <= '9') {
|
||||
@@ -507,6 +453,7 @@ yy25:
|
||||
}
|
||||
}
|
||||
yy26:
|
||||
YYDEBUG(26, *YYCURSOR);
|
||||
yyaccept = 1;
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
if (yych <= '/') goto yy6;
|
||||
@@ -514,6 +461,7 @@ yy26:
|
||||
if (yych == 'T') goto yy14;
|
||||
goto yy6;
|
||||
yy27:
|
||||
YYDEBUG(27, *YYCURSOR);
|
||||
yyaccept = 1;
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
if (yych <= '/') goto yy6;
|
||||
@@ -521,6 +469,7 @@ yy27:
|
||||
if (yych == 'T') goto yy14;
|
||||
goto yy6;
|
||||
yy28:
|
||||
YYDEBUG(28, *YYCURSOR);
|
||||
yyaccept = 1;
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
if (yych <= '/') goto yy6;
|
||||
@@ -528,9 +477,11 @@ yy28:
|
||||
if (yych == 'T') goto yy14;
|
||||
goto yy6;
|
||||
yy29:
|
||||
YYDEBUG(29, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
if ((YYLIMIT - YYCURSOR) < 3) YYFILL(3);
|
||||
yych = *YYCURSOR;
|
||||
YYDEBUG(30, *YYCURSOR);
|
||||
if (yych <= 'D') {
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych <= '9') goto yy29;
|
||||
@@ -546,9 +497,11 @@ yy29:
|
||||
}
|
||||
}
|
||||
yy31:
|
||||
YYDEBUG(31, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
if ((YYLIMIT - YYCURSOR) < 3) YYFILL(3);
|
||||
yych = *YYCURSOR;
|
||||
YYDEBUG(32, *YYCURSOR);
|
||||
if (yych <= 'C') {
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych <= '9') goto yy31;
|
||||
@@ -559,14 +512,17 @@ yy31:
|
||||
goto yy13;
|
||||
}
|
||||
yy33:
|
||||
YYDEBUG(33, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
if ((YYLIMIT - YYCURSOR) < 3) YYFILL(3);
|
||||
yych = *YYCURSOR;
|
||||
YYDEBUG(34, *YYCURSOR);
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych <= '9') goto yy33;
|
||||
if (yych == 'D') goto yy24;
|
||||
goto yy13;
|
||||
yy35:
|
||||
YYDEBUG(35, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= 'L') {
|
||||
if (yych <= '9') {
|
||||
@@ -585,18 +541,22 @@ yy35:
|
||||
goto yy13;
|
||||
}
|
||||
}
|
||||
YYDEBUG(36, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych != '-') goto yy39;
|
||||
YYDEBUG(37, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych <= '0') goto yy40;
|
||||
if (yych <= '1') goto yy41;
|
||||
goto yy13;
|
||||
yy38:
|
||||
YYDEBUG(38, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
if ((YYLIMIT - YYCURSOR) < 3) YYFILL(3);
|
||||
yych = *YYCURSOR;
|
||||
yy39:
|
||||
YYDEBUG(39, *YYCURSOR);
|
||||
if (yych <= 'L') {
|
||||
if (yych <= '9') {
|
||||
if (yych <= '/') goto yy13;
|
||||
@@ -616,17 +576,21 @@ yy39:
|
||||
}
|
||||
}
|
||||
yy40:
|
||||
YYDEBUG(40, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych <= '9') goto yy42;
|
||||
goto yy13;
|
||||
yy41:
|
||||
YYDEBUG(41, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych >= '3') goto yy13;
|
||||
yy42:
|
||||
YYDEBUG(42, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych != '-') goto yy13;
|
||||
YYDEBUG(43, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych <= '0') goto yy44;
|
||||
@@ -634,55 +598,70 @@ yy42:
|
||||
if (yych <= '3') goto yy46;
|
||||
goto yy13;
|
||||
yy44:
|
||||
YYDEBUG(44, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych <= '9') goto yy47;
|
||||
goto yy13;
|
||||
yy45:
|
||||
YYDEBUG(45, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych <= '9') goto yy47;
|
||||
goto yy13;
|
||||
yy46:
|
||||
YYDEBUG(46, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych >= '2') goto yy13;
|
||||
yy47:
|
||||
YYDEBUG(47, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych != 'T') goto yy13;
|
||||
YYDEBUG(48, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych <= '1') goto yy49;
|
||||
if (yych <= '2') goto yy50;
|
||||
goto yy13;
|
||||
yy49:
|
||||
YYDEBUG(49, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych <= '9') goto yy51;
|
||||
goto yy13;
|
||||
yy50:
|
||||
YYDEBUG(50, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych >= '5') goto yy13;
|
||||
yy51:
|
||||
YYDEBUG(51, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych != ':') goto yy13;
|
||||
YYDEBUG(52, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych >= '6') goto yy13;
|
||||
YYDEBUG(53, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych >= ':') goto yy13;
|
||||
YYDEBUG(54, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych != ':') goto yy13;
|
||||
YYDEBUG(55, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych >= '6') goto yy13;
|
||||
YYDEBUG(56, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych >= ':') goto yy13;
|
||||
YYDEBUG(57, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
#line 364 "ext/date/lib/parse_iso_intervals.re"
|
||||
YYDEBUG(58, *YYCURSOR);
|
||||
#line 286 "ext/date/lib/parse_iso_intervals.re"
|
||||
{
|
||||
DEBUG_OUTPUT("combinedrep");
|
||||
TIMELIB_INIT;
|
||||
@@ -701,14 +680,17 @@ yy51:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_PERIOD;
|
||||
}
|
||||
#line 705 "ext/date/lib/parse_iso_intervals.c"
|
||||
#line 684 "<stdout>"
|
||||
yy59:
|
||||
YYDEBUG(59, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych >= ':') goto yy13;
|
||||
YYDEBUG(60, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych >= ':') goto yy13;
|
||||
YYDEBUG(61, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') {
|
||||
if (yych == '-') goto yy64;
|
||||
@@ -719,33 +701,40 @@ yy59:
|
||||
goto yy13;
|
||||
}
|
||||
yy62:
|
||||
YYDEBUG(62, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '0') goto yy13;
|
||||
if (yych <= '9') goto yy85;
|
||||
goto yy13;
|
||||
yy63:
|
||||
YYDEBUG(63, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych <= '2') goto yy85;
|
||||
goto yy13;
|
||||
yy64:
|
||||
YYDEBUG(64, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych <= '0') goto yy65;
|
||||
if (yych <= '1') goto yy66;
|
||||
goto yy13;
|
||||
yy65:
|
||||
YYDEBUG(65, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '0') goto yy13;
|
||||
if (yych <= '9') goto yy67;
|
||||
goto yy13;
|
||||
yy66:
|
||||
YYDEBUG(66, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych >= '3') goto yy13;
|
||||
yy67:
|
||||
YYDEBUG(67, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych != '-') goto yy13;
|
||||
YYDEBUG(68, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych <= '0') goto yy69;
|
||||
@@ -753,58 +742,74 @@ yy67:
|
||||
if (yych <= '3') goto yy71;
|
||||
goto yy13;
|
||||
yy69:
|
||||
YYDEBUG(69, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '0') goto yy13;
|
||||
if (yych <= '9') goto yy72;
|
||||
goto yy13;
|
||||
yy70:
|
||||
YYDEBUG(70, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych <= '9') goto yy72;
|
||||
goto yy13;
|
||||
yy71:
|
||||
YYDEBUG(71, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych >= '2') goto yy13;
|
||||
yy72:
|
||||
YYDEBUG(72, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych != 'T') goto yy13;
|
||||
YYDEBUG(73, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych <= '1') goto yy74;
|
||||
if (yych <= '2') goto yy75;
|
||||
goto yy13;
|
||||
yy74:
|
||||
YYDEBUG(74, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych <= '9') goto yy76;
|
||||
goto yy13;
|
||||
yy75:
|
||||
YYDEBUG(75, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych >= '5') goto yy13;
|
||||
yy76:
|
||||
YYDEBUG(76, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych != ':') goto yy13;
|
||||
YYDEBUG(77, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych >= '6') goto yy13;
|
||||
YYDEBUG(78, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych >= ':') goto yy13;
|
||||
YYDEBUG(79, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych != ':') goto yy13;
|
||||
YYDEBUG(80, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych >= '6') goto yy13;
|
||||
YYDEBUG(81, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych >= ':') goto yy13;
|
||||
YYDEBUG(82, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych != 'Z') goto yy13;
|
||||
yy83:
|
||||
YYDEBUG(83, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
#line 298 "ext/date/lib/parse_iso_intervals.re"
|
||||
YYDEBUG(84, *YYCURSOR);
|
||||
#line 220 "ext/date/lib/parse_iso_intervals.re"
|
||||
{
|
||||
timelib_time *current;
|
||||
|
||||
@@ -827,8 +832,9 @@ yy83:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_ISO_DATE;
|
||||
}
|
||||
#line 831 "ext/date/lib/parse_iso_intervals.c"
|
||||
#line 836 "<stdout>"
|
||||
yy85:
|
||||
YYDEBUG(85, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych <= '0') goto yy86;
|
||||
@@ -836,60 +842,75 @@ yy85:
|
||||
if (yych <= '3') goto yy88;
|
||||
goto yy13;
|
||||
yy86:
|
||||
YYDEBUG(86, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '0') goto yy13;
|
||||
if (yych <= '9') goto yy89;
|
||||
goto yy13;
|
||||
yy87:
|
||||
YYDEBUG(87, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych <= '9') goto yy89;
|
||||
goto yy13;
|
||||
yy88:
|
||||
YYDEBUG(88, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych >= '2') goto yy13;
|
||||
yy89:
|
||||
YYDEBUG(89, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych != 'T') goto yy13;
|
||||
YYDEBUG(90, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych <= '1') goto yy91;
|
||||
if (yych <= '2') goto yy92;
|
||||
goto yy13;
|
||||
yy91:
|
||||
YYDEBUG(91, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych <= '9') goto yy93;
|
||||
goto yy13;
|
||||
yy92:
|
||||
YYDEBUG(92, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych >= '5') goto yy13;
|
||||
yy93:
|
||||
YYDEBUG(93, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych >= '6') goto yy13;
|
||||
YYDEBUG(94, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych >= ':') goto yy13;
|
||||
YYDEBUG(95, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych >= '6') goto yy13;
|
||||
YYDEBUG(96, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych >= ':') goto yy13;
|
||||
YYDEBUG(97, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych == 'Z') goto yy83;
|
||||
goto yy13;
|
||||
yy98:
|
||||
YYDEBUG(98, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
if (YYLIMIT <= YYCURSOR) YYFILL(1);
|
||||
yych = *YYCURSOR;
|
||||
YYDEBUG(99, *YYCURSOR);
|
||||
if (yych <= '/') goto yy100;
|
||||
if (yych <= '9') goto yy98;
|
||||
yy100:
|
||||
#line 287 "ext/date/lib/parse_iso_intervals.re"
|
||||
YYDEBUG(100, *YYCURSOR);
|
||||
#line 209 "ext/date/lib/parse_iso_intervals.re"
|
||||
{
|
||||
DEBUG_OUTPUT("recurrences");
|
||||
TIMELIB_INIT;
|
||||
@@ -899,9 +920,9 @@ yy100:
|
||||
s->have_recurrences = 1;
|
||||
return TIMELIB_PERIOD;
|
||||
}
|
||||
#line 903 "ext/date/lib/parse_iso_intervals.c"
|
||||
#line 924 "<stdout>"
|
||||
}
|
||||
#line 399 "ext/date/lib/parse_iso_intervals.re"
|
||||
#line 321 "ext/date/lib/parse_iso_intervals.re"
|
||||
|
||||
}
|
||||
#ifdef PHP_WIN32
|
||||
@@ -913,14 +934,14 @@ yy100:
|
||||
void timelib_strtointerval(char *s, size_t len,
|
||||
timelib_time **begin, timelib_time **end,
|
||||
timelib_rel_time **period, int *recurrences,
|
||||
struct timelib_error_container **errors)
|
||||
timelib_error_container **errors)
|
||||
{
|
||||
Scanner in;
|
||||
int t;
|
||||
char *e = s + len - 1;
|
||||
|
||||
memset(&in, 0, sizeof(in));
|
||||
in.errors = timelib_malloc(sizeof(struct timelib_error_container));
|
||||
in.errors = timelib_malloc(sizeof(timelib_error_container));
|
||||
in.errors->warning_count = 0;
|
||||
in.errors->warning_messages = NULL;
|
||||
in.errors->error_count = 0;
|
||||
@@ -960,7 +981,7 @@ void timelib_strtointerval(char *s, size_t len,
|
||||
in.begin->h = TIMELIB_UNSET;
|
||||
in.begin->i = TIMELIB_UNSET;
|
||||
in.begin->s = TIMELIB_UNSET;
|
||||
in.begin->f = 0;
|
||||
in.begin->us = 0;
|
||||
in.begin->z = 0;
|
||||
in.begin->dst = 0;
|
||||
in.begin->is_localtime = 0;
|
||||
@@ -973,7 +994,7 @@ void timelib_strtointerval(char *s, size_t len,
|
||||
in.end->h = TIMELIB_UNSET;
|
||||
in.end->i = TIMELIB_UNSET;
|
||||
in.end->s = TIMELIB_UNSET;
|
||||
in.end->f = 0;
|
||||
in.end->us = 0;
|
||||
in.end->z = 0;
|
||||
in.end->dst = 0;
|
||||
in.end->is_localtime = 0;
|
||||
|
||||
@@ -25,19 +25,10 @@
|
||||
/* $Id$ */
|
||||
|
||||
#include "timelib.h"
|
||||
#include "timelib_private.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#else
|
||||
#include <strings.h>
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# define strtoll(s, f, b) _atoi64(s)
|
||||
#elif !defined(HAVE_STRTOLL)
|
||||
@@ -48,15 +39,6 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#define TIMELIB_UNSET -99999
|
||||
|
||||
#define TIMELIB_SECOND 1
|
||||
#define TIMELIB_MINUTE 2
|
||||
#define TIMELIB_HOUR 3
|
||||
#define TIMELIB_DAY 4
|
||||
#define TIMELIB_MONTH 5
|
||||
#define TIMELIB_YEAR 6
|
||||
|
||||
#define EOI 257
|
||||
|
||||
#define TIMELIB_PERIOD 260
|
||||
@@ -88,18 +70,16 @@ typedef unsigned char uchar;
|
||||
#define YYDEBUG(s,c)
|
||||
#endif
|
||||
|
||||
#include "timelib_structs.h"
|
||||
|
||||
typedef struct Scanner {
|
||||
typedef struct _Scanner {
|
||||
int fd;
|
||||
uchar *lim, *str, *ptr, *cur, *tok, *pos;
|
||||
unsigned int line, len;
|
||||
struct timelib_error_container *errors;
|
||||
timelib_error_container *errors;
|
||||
|
||||
struct timelib_time *begin;
|
||||
struct timelib_time *end;
|
||||
struct timelib_rel_time *period;
|
||||
int recurrences;
|
||||
timelib_time *begin;
|
||||
timelib_time *end;
|
||||
timelib_rel_time *period;
|
||||
int recurrences;
|
||||
|
||||
int have_period;
|
||||
int have_recurrences;
|
||||
@@ -108,15 +88,6 @@ typedef struct Scanner {
|
||||
int have_end_date;
|
||||
} Scanner;
|
||||
|
||||
static void add_warning(Scanner *s, char *error)
|
||||
{
|
||||
s->errors->warning_count++;
|
||||
s->errors->warning_messages = timelib_realloc(s->errors->warning_messages, s->errors->warning_count * sizeof(timelib_error_message));
|
||||
s->errors->warning_messages[s->errors->warning_count - 1].position = s->tok ? s->tok - s->str : 0;
|
||||
s->errors->warning_messages[s->errors->warning_count - 1].character = s->tok ? *s->tok : 0;
|
||||
s->errors->warning_messages[s->errors->warning_count - 1].message = timelib_strdup(error);
|
||||
}
|
||||
|
||||
static void add_error(Scanner *s, char *error)
|
||||
{
|
||||
s->errors->error_count++;
|
||||
@@ -180,55 +151,6 @@ static timelib_ull timelib_get_unsigned_nr(char **ptr, int max_length)
|
||||
return dir * timelib_get_nr(ptr, max_length);
|
||||
}
|
||||
|
||||
static void timelib_eat_spaces(char **ptr)
|
||||
{
|
||||
while (**ptr == ' ' || **ptr == '\t') {
|
||||
++*ptr;
|
||||
}
|
||||
}
|
||||
|
||||
static void timelib_eat_until_separator(char **ptr)
|
||||
{
|
||||
while (strchr(" \t.,:;/-0123456789", **ptr) == NULL) {
|
||||
++*ptr;
|
||||
}
|
||||
}
|
||||
|
||||
static timelib_long timelib_get_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found, const timelib_tzdb *tzdb)
|
||||
{
|
||||
timelib_long retval = 0;
|
||||
|
||||
*tz_not_found = 0;
|
||||
|
||||
while (**ptr == ' ' || **ptr == '\t' || **ptr == '(') {
|
||||
++*ptr;
|
||||
}
|
||||
if ((*ptr)[0] == 'G' && (*ptr)[1] == 'M' && (*ptr)[2] == 'T' && ((*ptr)[3] == '+' || (*ptr)[3] == '-')) {
|
||||
*ptr += 3;
|
||||
}
|
||||
if (**ptr == '+') {
|
||||
++*ptr;
|
||||
t->is_localtime = 1;
|
||||
t->zone_type = TIMELIB_ZONETYPE_OFFSET;
|
||||
*tz_not_found = 0;
|
||||
t->dst = 0;
|
||||
|
||||
retval = -1 * timelib_parse_tz_cor(ptr);
|
||||
} else if (**ptr == '-') {
|
||||
++*ptr;
|
||||
t->is_localtime = 1;
|
||||
t->zone_type = TIMELIB_ZONETYPE_OFFSET;
|
||||
*tz_not_found = 0;
|
||||
t->dst = 0;
|
||||
|
||||
retval = timelib_parse_tz_cor(ptr);
|
||||
}
|
||||
while (**ptr == ')') {
|
||||
++*ptr;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
#define timelib_split_free(arg) { \
|
||||
int i; \
|
||||
for (i = 0; i < arg.c; i++) { \
|
||||
@@ -407,14 +329,14 @@ isoweek = year4 "-"? "W" weekofyear;
|
||||
void timelib_strtointerval(char *s, size_t len,
|
||||
timelib_time **begin, timelib_time **end,
|
||||
timelib_rel_time **period, int *recurrences,
|
||||
struct timelib_error_container **errors)
|
||||
timelib_error_container **errors)
|
||||
{
|
||||
Scanner in;
|
||||
int t;
|
||||
char *e = s + len - 1;
|
||||
|
||||
memset(&in, 0, sizeof(in));
|
||||
in.errors = timelib_malloc(sizeof(struct timelib_error_container));
|
||||
in.errors = timelib_malloc(sizeof(timelib_error_container));
|
||||
in.errors->warning_count = 0;
|
||||
in.errors->warning_messages = NULL;
|
||||
in.errors->error_count = 0;
|
||||
@@ -454,7 +376,7 @@ void timelib_strtointerval(char *s, size_t len,
|
||||
in.begin->h = TIMELIB_UNSET;
|
||||
in.begin->i = TIMELIB_UNSET;
|
||||
in.begin->s = TIMELIB_UNSET;
|
||||
in.begin->f = 0;
|
||||
in.begin->us = 0;
|
||||
in.begin->z = 0;
|
||||
in.begin->dst = 0;
|
||||
in.begin->is_localtime = 0;
|
||||
@@ -467,7 +389,7 @@ void timelib_strtointerval(char *s, size_t len,
|
||||
in.end->h = TIMELIB_UNSET;
|
||||
in.end->i = TIMELIB_UNSET;
|
||||
in.end->s = TIMELIB_UNSET;
|
||||
in.end->f = 0;
|
||||
in.end->us = 0;
|
||||
in.end->z = 0;
|
||||
in.end->dst = 0;
|
||||
in.end->is_localtime = 0;
|
||||
|
||||
+234
-67
@@ -23,18 +23,7 @@
|
||||
*/
|
||||
|
||||
#include "timelib.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef HAVE_LOCALE_H
|
||||
#include <locale.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#else
|
||||
#include <strings.h>
|
||||
#endif
|
||||
#include "timelib_private.h"
|
||||
|
||||
#define TIMELIB_SUPPORTS_V2DATA
|
||||
#include "timezonedb.h"
|
||||
@@ -49,13 +38,32 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
#define timelib_conv_int(l) (l)
|
||||
#else
|
||||
#define timelib_conv_int(l) ((l & 0x000000ff) << 24) + ((l & 0x0000ff00) << 8) + ((l & 0x00ff0000) >> 8) + ((l & 0xff000000) >> 24)
|
||||
#if defined(__s390__)
|
||||
# if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
||||
# define WORDS_BIGENDIAN
|
||||
# else
|
||||
# undef WORDS_BIGENDIAN
|
||||
# endif
|
||||
#endif
|
||||
|
||||
static int read_preamble(const unsigned char **tzf, timelib_tzinfo *tz)
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
static inline uint32_t timelib_conv_int_unsigned(uint32_t value)
|
||||
{
|
||||
return value;
|
||||
}
|
||||
#else
|
||||
static inline uint32_t timelib_conv_int_unsigned(uint32_t value)
|
||||
{
|
||||
return ((value & 0x000000ff) << 24) +
|
||||
((value & 0x0000ff00) << 8) +
|
||||
((value & 0x00ff0000) >> 8) +
|
||||
((value & 0xff000000) >> 24);
|
||||
}
|
||||
#endif
|
||||
|
||||
#define timelib_conv_int_signed(value) ((int32_t) timelib_conv_int_unsigned((int32_t) value))
|
||||
|
||||
static int read_php_preamble(const unsigned char **tzf, timelib_tzinfo *tz)
|
||||
{
|
||||
uint32_t version;
|
||||
|
||||
@@ -78,21 +86,67 @@ static int read_preamble(const unsigned char **tzf, timelib_tzinfo *tz)
|
||||
return version;
|
||||
}
|
||||
|
||||
static int read_tzif_preamble(const unsigned char **tzf, timelib_tzinfo *tz)
|
||||
{
|
||||
uint32_t version;
|
||||
|
||||
/* read ID */
|
||||
switch ((*tzf)[4]) {
|
||||
case '\0':
|
||||
version = 0;
|
||||
break;
|
||||
case '2':
|
||||
version = 2;
|
||||
break;
|
||||
case '3':
|
||||
version = 3;
|
||||
break;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
*tzf += 5;
|
||||
|
||||
/* set BC flag and country code to default */
|
||||
tz->bc = 0;
|
||||
tz->location.country_code[0] = '?';
|
||||
tz->location.country_code[1] = '?';
|
||||
tz->location.country_code[2] = '\0';
|
||||
|
||||
/* skip rest of preamble */
|
||||
*tzf += 15;
|
||||
|
||||
return version;
|
||||
}
|
||||
|
||||
static int read_preamble(const unsigned char **tzf, timelib_tzinfo *tz, unsigned int *type)
|
||||
{
|
||||
/* read marker (TZif) or (PHP) */
|
||||
if (memcmp(*tzf, "PHP", 3) == 0) {
|
||||
*type = TIMELIB_TZINFO_PHP;
|
||||
return read_php_preamble(tzf, tz);
|
||||
} else if (memcmp(*tzf, "TZif", 4) == 0) {
|
||||
*type = TIMELIB_TZINFO_ZONEINFO;
|
||||
return read_tzif_preamble(tzf, tz);
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
static void read_header(const unsigned char **tzf, timelib_tzinfo *tz)
|
||||
{
|
||||
uint32_t buffer[6];
|
||||
|
||||
memcpy(&buffer, *tzf, sizeof(buffer));
|
||||
tz->bit32.ttisgmtcnt = timelib_conv_int(buffer[0]);
|
||||
tz->bit32.ttisstdcnt = timelib_conv_int(buffer[1]);
|
||||
tz->bit32.leapcnt = timelib_conv_int(buffer[2]);
|
||||
tz->bit32.timecnt = timelib_conv_int(buffer[3]);
|
||||
tz->bit32.typecnt = timelib_conv_int(buffer[4]);
|
||||
tz->bit32.charcnt = timelib_conv_int(buffer[5]);
|
||||
tz->bit32.ttisgmtcnt = timelib_conv_int_unsigned(buffer[0]);
|
||||
tz->bit32.ttisstdcnt = timelib_conv_int_unsigned(buffer[1]);
|
||||
tz->bit32.leapcnt = timelib_conv_int_unsigned(buffer[2]);
|
||||
tz->bit32.timecnt = timelib_conv_int_unsigned(buffer[3]);
|
||||
tz->bit32.typecnt = timelib_conv_int_unsigned(buffer[4]);
|
||||
tz->bit32.charcnt = timelib_conv_int_unsigned(buffer[5]);
|
||||
*tzf += sizeof(buffer);
|
||||
}
|
||||
|
||||
static void skip_64bit_transistions(const unsigned char **tzf, timelib_tzinfo *tz)
|
||||
static void skip_64bit_transitions(const unsigned char **tzf, timelib_tzinfo *tz)
|
||||
{
|
||||
if (tz->bit64.timecnt) {
|
||||
*tzf += (sizeof(int64_t) * tz->bit64.timecnt);
|
||||
@@ -100,7 +154,7 @@ static void skip_64bit_transistions(const unsigned char **tzf, timelib_tzinfo *t
|
||||
}
|
||||
}
|
||||
|
||||
static void read_transistions(const unsigned char **tzf, timelib_tzinfo *tz)
|
||||
static int read_transitions(const unsigned char **tzf, timelib_tzinfo *tz)
|
||||
{
|
||||
int32_t *buffer = NULL;
|
||||
uint32_t i;
|
||||
@@ -109,18 +163,22 @@ static void read_transistions(const unsigned char **tzf, timelib_tzinfo *tz)
|
||||
if (tz->bit32.timecnt) {
|
||||
buffer = (int32_t*) timelib_malloc(tz->bit32.timecnt * sizeof(int32_t));
|
||||
if (!buffer) {
|
||||
return;
|
||||
return TIMELIB_ERROR_CANNOT_ALLOCATE;
|
||||
}
|
||||
memcpy(buffer, *tzf, sizeof(int32_t) * tz->bit32.timecnt);
|
||||
*tzf += (sizeof(int32_t) * tz->bit32.timecnt);
|
||||
for (i = 0; i < tz->bit32.timecnt; i++) {
|
||||
buffer[i] = timelib_conv_int(buffer[i]);
|
||||
buffer[i] = timelib_conv_int_signed(buffer[i]);
|
||||
/* Sanity check to see whether TS is just increasing */
|
||||
if (i > 0 && !(buffer[i] > buffer[i - 1])) {
|
||||
return TIMELIB_ERROR_CORRUPT_TRANSITIONS_DONT_INCREASE;
|
||||
}
|
||||
}
|
||||
|
||||
cbuffer = (unsigned char*) timelib_malloc(tz->bit32.timecnt * sizeof(unsigned char));
|
||||
if (!cbuffer) {
|
||||
timelib_free(buffer);
|
||||
return;
|
||||
return TIMELIB_ERROR_CANNOT_ALLOCATE;
|
||||
}
|
||||
memcpy(cbuffer, *tzf, sizeof(unsigned char) * tz->bit32.timecnt);
|
||||
*tzf += sizeof(unsigned char) * tz->bit32.timecnt;
|
||||
@@ -128,6 +186,8 @@ static void read_transistions(const unsigned char **tzf, timelib_tzinfo *tz)
|
||||
|
||||
tz->trans = buffer;
|
||||
tz->trans_idx = cbuffer;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void skip_64bit_types(const unsigned char **tzf, timelib_tzinfo *tz)
|
||||
@@ -145,7 +205,7 @@ static void skip_64bit_types(const unsigned char **tzf, timelib_tzinfo *tz)
|
||||
}
|
||||
}
|
||||
|
||||
static void read_types(const unsigned char **tzf, timelib_tzinfo *tz)
|
||||
static int read_types(const unsigned char **tzf, timelib_tzinfo *tz)
|
||||
{
|
||||
unsigned char *buffer;
|
||||
int32_t *leap_buffer;
|
||||
@@ -153,20 +213,21 @@ static void read_types(const unsigned char **tzf, timelib_tzinfo *tz)
|
||||
|
||||
buffer = (unsigned char*) timelib_malloc(tz->bit32.typecnt * sizeof(unsigned char) * 6);
|
||||
if (!buffer) {
|
||||
return;
|
||||
return TIMELIB_ERROR_CANNOT_ALLOCATE;
|
||||
}
|
||||
memcpy(buffer, *tzf, sizeof(unsigned char) * 6 * tz->bit32.typecnt);
|
||||
*tzf += sizeof(unsigned char) * 6 * tz->bit32.typecnt;
|
||||
|
||||
tz->type = (ttinfo*) timelib_malloc(tz->bit32.typecnt * sizeof(struct ttinfo));
|
||||
tz->type = (ttinfo*) timelib_malloc(tz->bit32.typecnt * sizeof(ttinfo));
|
||||
if (!tz->type) {
|
||||
timelib_free(buffer);
|
||||
return;
|
||||
return TIMELIB_ERROR_CANNOT_ALLOCATE;
|
||||
}
|
||||
|
||||
for (i = 0; i < tz->bit32.typecnt; i++) {
|
||||
j = i * 6;
|
||||
tz->type[i].offset = (buffer[j] * 16777216) + (buffer[j + 1] * 65536) + (buffer[j + 2] * 256) + buffer[j + 3];
|
||||
tz->type[i].offset = 0;
|
||||
tz->type[i].offset += (int32_t) (((uint32_t) buffer[j]) << 24) + (buffer[j + 1] << 16) + (buffer[j + 2] << 8) + tz->type[i].offset + buffer[j + 3];
|
||||
tz->type[i].isdst = buffer[j + 4];
|
||||
tz->type[i].abbr_idx = buffer[j + 5];
|
||||
}
|
||||
@@ -174,7 +235,7 @@ static void read_types(const unsigned char **tzf, timelib_tzinfo *tz)
|
||||
|
||||
tz->timezone_abbr = (char*) timelib_malloc(tz->bit32.charcnt);
|
||||
if (!tz->timezone_abbr) {
|
||||
return;
|
||||
return TIMELIB_ERROR_CORRUPT_NO_ABBREVIATION;
|
||||
}
|
||||
memcpy(tz->timezone_abbr, *tzf, sizeof(char) * tz->bit32.charcnt);
|
||||
*tzf += sizeof(char) * tz->bit32.charcnt;
|
||||
@@ -182,7 +243,7 @@ static void read_types(const unsigned char **tzf, timelib_tzinfo *tz)
|
||||
if (tz->bit32.leapcnt) {
|
||||
leap_buffer = (int32_t *) timelib_malloc(tz->bit32.leapcnt * 2 * sizeof(int32_t));
|
||||
if (!leap_buffer) {
|
||||
return;
|
||||
return TIMELIB_ERROR_CANNOT_ALLOCATE;
|
||||
}
|
||||
memcpy(leap_buffer, *tzf, sizeof(int32_t) * tz->bit32.leapcnt * 2);
|
||||
*tzf += sizeof(int32_t) * tz->bit32.leapcnt * 2;
|
||||
@@ -190,11 +251,11 @@ static void read_types(const unsigned char **tzf, timelib_tzinfo *tz)
|
||||
tz->leap_times = (tlinfo*) timelib_malloc(tz->bit32.leapcnt * sizeof(tlinfo));
|
||||
if (!tz->leap_times) {
|
||||
timelib_free(leap_buffer);
|
||||
return;
|
||||
return TIMELIB_ERROR_CANNOT_ALLOCATE;
|
||||
}
|
||||
for (i = 0; i < tz->bit32.leapcnt; i++) {
|
||||
tz->leap_times[i].trans = timelib_conv_int(leap_buffer[i * 2]);
|
||||
tz->leap_times[i].offset = timelib_conv_int(leap_buffer[i * 2 + 1]);
|
||||
tz->leap_times[i].trans = timelib_conv_int_signed(leap_buffer[i * 2]);
|
||||
tz->leap_times[i].offset = timelib_conv_int_signed(leap_buffer[i * 2 + 1]);
|
||||
}
|
||||
timelib_free(leap_buffer);
|
||||
}
|
||||
@@ -202,7 +263,7 @@ static void read_types(const unsigned char **tzf, timelib_tzinfo *tz)
|
||||
if (tz->bit32.ttisstdcnt) {
|
||||
buffer = (unsigned char*) timelib_malloc(tz->bit32.ttisstdcnt * sizeof(unsigned char));
|
||||
if (!buffer) {
|
||||
return;
|
||||
return TIMELIB_ERROR_CANNOT_ALLOCATE;
|
||||
}
|
||||
memcpy(buffer, *tzf, sizeof(unsigned char) * tz->bit32.ttisstdcnt);
|
||||
*tzf += sizeof(unsigned char) * tz->bit32.ttisstdcnt;
|
||||
@@ -216,7 +277,7 @@ static void read_types(const unsigned char **tzf, timelib_tzinfo *tz)
|
||||
if (tz->bit32.ttisgmtcnt) {
|
||||
buffer = (unsigned char*) timelib_malloc(tz->bit32.ttisgmtcnt * sizeof(unsigned char));
|
||||
if (!buffer) {
|
||||
return;
|
||||
return TIMELIB_ERROR_CANNOT_ALLOCATE;
|
||||
}
|
||||
memcpy(buffer, *tzf, sizeof(unsigned char) * tz->bit32.ttisgmtcnt);
|
||||
*tzf += sizeof(unsigned char) * tz->bit32.ttisgmtcnt;
|
||||
@@ -226,6 +287,8 @@ static void read_types(const unsigned char **tzf, timelib_tzinfo *tz)
|
||||
}
|
||||
timelib_free(buffer);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void skip_posix_string(const unsigned char **tzf, timelib_tzinfo *tz)
|
||||
@@ -246,11 +309,11 @@ static void read_location(const unsigned char **tzf, timelib_tzinfo *tz)
|
||||
uint32_t comments_len;
|
||||
|
||||
memcpy(&buffer, *tzf, sizeof(buffer));
|
||||
tz->location.latitude = timelib_conv_int(buffer[0]);
|
||||
tz->location.latitude = timelib_conv_int_unsigned(buffer[0]);
|
||||
tz->location.latitude = (tz->location.latitude / 100000) - 90;
|
||||
tz->location.longitude = timelib_conv_int(buffer[1]);
|
||||
tz->location.longitude = timelib_conv_int_unsigned(buffer[1]);
|
||||
tz->location.longitude = (tz->location.longitude / 100000) - 180;
|
||||
comments_len = timelib_conv_int(buffer[2]);
|
||||
comments_len = timelib_conv_int_unsigned(buffer[2]);
|
||||
*tzf += sizeof(buffer);
|
||||
|
||||
tz->location.comments = timelib_malloc(comments_len + 1);
|
||||
@@ -259,6 +322,15 @@ static void read_location(const unsigned char **tzf, timelib_tzinfo *tz)
|
||||
*tzf += comments_len;
|
||||
}
|
||||
|
||||
static void set_default_location_and_comments(const unsigned char **tzf, timelib_tzinfo *tz)
|
||||
{
|
||||
tz->location.latitude = 0;
|
||||
tz->location.longitude = 0;
|
||||
tz->location.comments = timelib_malloc(2);
|
||||
tz->location.comments[0] = '?';
|
||||
tz->location.comments[1] = '\0';
|
||||
}
|
||||
|
||||
void timelib_dump_tzinfo(timelib_tzinfo *tz)
|
||||
{
|
||||
uint32_t i;
|
||||
@@ -307,7 +379,13 @@ static int seek_to_tz_position(const unsigned char **tzf, char *timezone, const
|
||||
int left = 0, right = tzdb->index_size - 1;
|
||||
#ifdef HAVE_SETLOCALE
|
||||
char *cur_locale = NULL, *tmp;
|
||||
#endif
|
||||
|
||||
if (tzdb->index_size == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef HAVE_SETLOCALE
|
||||
tmp = setlocale(LC_CTYPE, NULL);
|
||||
if (tmp) {
|
||||
cur_locale = timelib_strdup(tmp);
|
||||
@@ -346,10 +424,10 @@ const timelib_tzdb *timelib_builtin_db(void)
|
||||
return &timezonedb_builtin;
|
||||
}
|
||||
|
||||
const timelib_tzdb_index_entry *timelib_timezone_builtin_identifiers_list(int *count)
|
||||
const timelib_tzdb_index_entry *timelib_timezone_identifiers_list(timelib_tzdb *tzdb, int *count)
|
||||
{
|
||||
*count = sizeof(timezonedb_idx_builtin) / sizeof(*timezonedb_idx_builtin);
|
||||
return timezonedb_idx_builtin;
|
||||
*count = tzdb->index_size;
|
||||
return tzdb->index;
|
||||
}
|
||||
|
||||
int timelib_timezone_id_is_valid(char *timezone, const timelib_tzdb *tzdb)
|
||||
@@ -358,9 +436,17 @@ int timelib_timezone_id_is_valid(char *timezone, const timelib_tzdb *tzdb)
|
||||
return (seek_to_tz_position(&tzf, timezone, tzdb));
|
||||
}
|
||||
|
||||
static void skip_64bit_preamble(const unsigned char **tzf, timelib_tzinfo *tz)
|
||||
static int skip_64bit_preamble(const unsigned char **tzf, timelib_tzinfo *tz)
|
||||
{
|
||||
*tzf += 20;
|
||||
if (memcmp(*tzf, "TZif2", 5) == 0) {
|
||||
*tzf += 20;
|
||||
return 1;
|
||||
} else if (memcmp(*tzf, "TZif3", 5) == 0) {
|
||||
*tzf += 20;
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void read_64bit_header(const unsigned char **tzf, timelib_tzinfo *tz)
|
||||
@@ -368,43 +454,124 @@ static void read_64bit_header(const unsigned char **tzf, timelib_tzinfo *tz)
|
||||
uint32_t buffer[6];
|
||||
|
||||
memcpy(&buffer, *tzf, sizeof(buffer));
|
||||
tz->bit64.ttisgmtcnt = timelib_conv_int(buffer[0]);
|
||||
tz->bit64.ttisstdcnt = timelib_conv_int(buffer[1]);
|
||||
tz->bit64.leapcnt = timelib_conv_int(buffer[2]);
|
||||
tz->bit64.timecnt = timelib_conv_int(buffer[3]);
|
||||
tz->bit64.typecnt = timelib_conv_int(buffer[4]);
|
||||
tz->bit64.charcnt = timelib_conv_int(buffer[5]);
|
||||
tz->bit64.ttisgmtcnt = timelib_conv_int_unsigned(buffer[0]);
|
||||
tz->bit64.ttisstdcnt = timelib_conv_int_unsigned(buffer[1]);
|
||||
tz->bit64.leapcnt = timelib_conv_int_unsigned(buffer[2]);
|
||||
tz->bit64.timecnt = timelib_conv_int_unsigned(buffer[3]);
|
||||
tz->bit64.typecnt = timelib_conv_int_unsigned(buffer[4]);
|
||||
tz->bit64.charcnt = timelib_conv_int_unsigned(buffer[5]);
|
||||
*tzf += sizeof(buffer);
|
||||
}
|
||||
|
||||
timelib_tzinfo *timelib_parse_tzfile(char *timezone, const timelib_tzdb *tzdb)
|
||||
static timelib_tzinfo* timelib_tzinfo_ctor(char *name)
|
||||
{
|
||||
timelib_tzinfo *t;
|
||||
t = timelib_calloc(1, sizeof(timelib_tzinfo));
|
||||
t->name = timelib_strdup(name);
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
timelib_tzinfo *timelib_parse_tzfile(char *timezone, const timelib_tzdb *tzdb, int *error_code)
|
||||
{
|
||||
const unsigned char *tzf;
|
||||
timelib_tzinfo *tmp;
|
||||
int version;
|
||||
int transitions_result, types_result;
|
||||
unsigned int type; /* TIMELIB_TZINFO_PHP or TIMELIB_TZINFO_ZONEINFO */
|
||||
|
||||
if (seek_to_tz_position(&tzf, timezone, tzdb)) {
|
||||
tmp = timelib_tzinfo_ctor(timezone);
|
||||
|
||||
version = read_preamble(&tzf, tmp);
|
||||
version = read_preamble(&tzf, tmp, &type);
|
||||
if (version == -1) {
|
||||
*error_code = TIMELIB_ERROR_UNSUPPORTED_VERSION;
|
||||
timelib_tzinfo_dtor(tmp);
|
||||
return NULL;
|
||||
}
|
||||
//printf("- timezone: %s, version: %0d\n", timezone, version);
|
||||
|
||||
read_header(&tzf, tmp);
|
||||
read_transistions(&tzf, tmp);
|
||||
read_types(&tzf, tmp);
|
||||
if (version == 2) {
|
||||
skip_64bit_preamble(&tzf, tmp);
|
||||
if ((transitions_result = read_transitions(&tzf, tmp)) != 0) {
|
||||
/* Corrupt file as transitions do not increase */
|
||||
*error_code = transitions_result;
|
||||
timelib_tzinfo_dtor(tmp);
|
||||
return NULL;
|
||||
}
|
||||
if ((types_result = read_types(&tzf, tmp)) != 0) {
|
||||
*error_code = types_result;
|
||||
timelib_tzinfo_dtor(tmp);
|
||||
return NULL;
|
||||
}
|
||||
if (version == 2 || version == 3) {
|
||||
if (!skip_64bit_preamble(&tzf, tmp)) {
|
||||
/* 64 bit preamble is not in place */
|
||||
*error_code = TIMELIB_ERROR_CORRUPT_NO_64BIT_PREAMBLE;
|
||||
return NULL;
|
||||
}
|
||||
read_64bit_header(&tzf, tmp);
|
||||
skip_64bit_transistions(&tzf, tmp);
|
||||
skip_64bit_transitions(&tzf, tmp);
|
||||
skip_64bit_types(&tzf, tmp);
|
||||
skip_posix_string(&tzf, tmp);
|
||||
}
|
||||
read_location(&tzf, tmp);
|
||||
|
||||
if (type == TIMELIB_TZINFO_PHP) {
|
||||
read_location(&tzf, tmp);
|
||||
} else {
|
||||
set_default_location_and_comments(&tzf, tmp);
|
||||
}
|
||||
} else {
|
||||
*error_code = TIMELIB_ERROR_NO_SUCH_TIMEZONE;
|
||||
tmp = NULL;
|
||||
}
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
void timelib_tzinfo_dtor(timelib_tzinfo *tz)
|
||||
{
|
||||
TIMELIB_TIME_FREE(tz->name);
|
||||
TIMELIB_TIME_FREE(tz->trans);
|
||||
TIMELIB_TIME_FREE(tz->trans_idx);
|
||||
TIMELIB_TIME_FREE(tz->type);
|
||||
TIMELIB_TIME_FREE(tz->timezone_abbr);
|
||||
TIMELIB_TIME_FREE(tz->leap_times);
|
||||
TIMELIB_TIME_FREE(tz->location.comments);
|
||||
TIMELIB_TIME_FREE(tz);
|
||||
tz = NULL;
|
||||
}
|
||||
|
||||
timelib_tzinfo *timelib_tzinfo_clone(timelib_tzinfo *tz)
|
||||
{
|
||||
timelib_tzinfo *tmp = timelib_tzinfo_ctor(tz->name);
|
||||
tmp->bit32.ttisgmtcnt = tz->bit32.ttisgmtcnt;
|
||||
tmp->bit32.ttisstdcnt = tz->bit32.ttisstdcnt;
|
||||
tmp->bit32.leapcnt = tz->bit32.leapcnt;
|
||||
tmp->bit32.timecnt = tz->bit32.timecnt;
|
||||
tmp->bit32.typecnt = tz->bit32.typecnt;
|
||||
tmp->bit32.charcnt = tz->bit32.charcnt;
|
||||
|
||||
if (tz->bit32.timecnt) {
|
||||
tmp->trans = (int32_t *) timelib_malloc(tz->bit32.timecnt * sizeof(int32_t));
|
||||
tmp->trans_idx = (unsigned char*) timelib_malloc(tz->bit32.timecnt * sizeof(unsigned char));
|
||||
memcpy(tmp->trans, tz->trans, tz->bit32.timecnt * sizeof(int32_t));
|
||||
memcpy(tmp->trans_idx, tz->trans_idx, tz->bit32.timecnt * sizeof(unsigned char));
|
||||
}
|
||||
|
||||
tmp->type = (ttinfo*) timelib_malloc(tz->bit32.typecnt * sizeof(ttinfo));
|
||||
memcpy(tmp->type, tz->type, tz->bit32.typecnt * sizeof(ttinfo));
|
||||
|
||||
tmp->timezone_abbr = (char*) timelib_malloc(tz->bit32.charcnt);
|
||||
memcpy(tmp->timezone_abbr, tz->timezone_abbr, tz->bit32.charcnt);
|
||||
|
||||
if (tz->bit32.leapcnt) {
|
||||
tmp->leap_times = (tlinfo*) timelib_malloc(tz->bit32.leapcnt * sizeof(tlinfo));
|
||||
memcpy(tmp->leap_times, tz->leap_times, tz->bit32.leapcnt * sizeof(tlinfo));
|
||||
}
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
static ttinfo* fetch_timezone_offset(timelib_tzinfo *tz, timelib_sll ts, timelib_sll *transition_time)
|
||||
{
|
||||
uint32_t i;
|
||||
@@ -483,18 +650,18 @@ timelib_time_offset *timelib_get_time_zone_info(timelib_sll ts, timelib_tzinfo *
|
||||
int32_t offset = 0, leap_secs = 0;
|
||||
char *abbr;
|
||||
timelib_time_offset *tmp = timelib_time_offset_ctor();
|
||||
timelib_sll transistion_time;
|
||||
timelib_sll transition_time;
|
||||
|
||||
if ((to = fetch_timezone_offset(tz, ts, &transistion_time))) {
|
||||
if ((to = fetch_timezone_offset(tz, ts, &transition_time))) {
|
||||
offset = to->offset;
|
||||
abbr = &(tz->timezone_abbr[to->abbr_idx]);
|
||||
tmp->is_dst = to->isdst;
|
||||
tmp->transistion_time = transistion_time;
|
||||
tmp->transition_time = transition_time;
|
||||
} else {
|
||||
offset = 0;
|
||||
abbr = tz->timezone_abbr;
|
||||
tmp->is_dst = 0;
|
||||
tmp->transistion_time = 0;
|
||||
tmp->transition_time = 0;
|
||||
}
|
||||
|
||||
if ((tl = fetch_leaptime_offset(tz, ts))) {
|
||||
@@ -516,7 +683,7 @@ timelib_sll timelib_get_current_offset(timelib_time *t)
|
||||
switch (t->zone_type) {
|
||||
case TIMELIB_ZONETYPE_ABBR:
|
||||
case TIMELIB_ZONETYPE_OFFSET:
|
||||
return (t->z + t->dst) * -60;
|
||||
return t->z + (t->dst * 3600);
|
||||
|
||||
case TIMELIB_ZONETYPE_ID:
|
||||
gmt_offset = timelib_get_time_zone_info(t->sse, t->tz_info);
|
||||
|
||||
+65
-123
@@ -23,18 +23,31 @@
|
||||
*/
|
||||
|
||||
#include "timelib.h"
|
||||
#include "timelib_private.h"
|
||||
#include <ctype.h>
|
||||
#include <math.h>
|
||||
|
||||
#define TIMELIB_TIME_FREE(m) \
|
||||
if (m) { \
|
||||
timelib_free(m); \
|
||||
m = NULL; \
|
||||
} \
|
||||
|
||||
#define TIMELIB_LLABS(y) (y < 0 ? (y * -1) : y)
|
||||
|
||||
#define HOUR(a) (int)(a * 60)
|
||||
const char *timelib_error_messages[8] = {
|
||||
"No error",
|
||||
"Can not allocate buffer for parsing",
|
||||
"Corrupt tzfile: The transitions in the file don't always increase",
|
||||
"Corrupt tzfile: The expected 64-bit preamble is missing",
|
||||
"Corrupt tzfile: No abbreviation could be found for a transition",
|
||||
"The version used in this timezone identifier is unsupported",
|
||||
"No timezone with this name could be found",
|
||||
};
|
||||
|
||||
const char *timelib_get_error_message(int error_code)
|
||||
{
|
||||
int entries = sizeof(timelib_error_messages) / sizeof(char*);
|
||||
|
||||
if (error_code >= 0 && error_code < entries) {
|
||||
return timelib_error_messages[error_code];
|
||||
}
|
||||
return "Unknown error code";
|
||||
}
|
||||
|
||||
timelib_time* timelib_time_ctor(void)
|
||||
{
|
||||
@@ -44,12 +57,23 @@ timelib_time* timelib_time_ctor(void)
|
||||
return t;
|
||||
}
|
||||
|
||||
timelib_rel_time* timelib_rel_time_ctor(void)
|
||||
void timelib_time_dtor(timelib_time* t)
|
||||
{
|
||||
timelib_rel_time *t;
|
||||
t = timelib_calloc(1, sizeof(timelib_rel_time));
|
||||
TIMELIB_TIME_FREE(t->tz_abbr);
|
||||
TIMELIB_TIME_FREE(t);
|
||||
}
|
||||
|
||||
return t;
|
||||
int timelib_time_compare(timelib_time *t1, timelib_time *t2)
|
||||
{
|
||||
if (t1->sse == t2->sse) {
|
||||
if (t1->us == t2->us) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return (t1->us < t2->us) ? -1 : 1;
|
||||
}
|
||||
|
||||
return (t1->sse < t2->sse) ? -1 : 1;
|
||||
}
|
||||
|
||||
timelib_time* timelib_time_clone(timelib_time *orig)
|
||||
@@ -65,21 +89,17 @@ timelib_time* timelib_time_clone(timelib_time *orig)
|
||||
return tmp;
|
||||
}
|
||||
|
||||
int timelib_time_compare(timelib_time *t1, timelib_time *t2)
|
||||
timelib_rel_time* timelib_rel_time_ctor(void)
|
||||
{
|
||||
if (t1->sse == t2->sse) {
|
||||
if (t1->f == t2->f) {
|
||||
return 0;
|
||||
}
|
||||
timelib_rel_time *t;
|
||||
t = timelib_calloc(1, sizeof(timelib_rel_time));
|
||||
|
||||
if (t1->sse < 0) {
|
||||
return (t1->f < t2->f) ? 1 : -1;
|
||||
} else {
|
||||
return (t1->f < t2->f) ? -1 : 1;
|
||||
}
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
return (t1->sse < t2->sse) ? -1 : 1;
|
||||
void timelib_rel_time_dtor(timelib_rel_time* t)
|
||||
{
|
||||
TIMELIB_TIME_FREE(t);
|
||||
}
|
||||
|
||||
timelib_rel_time* timelib_rel_time_clone(timelib_rel_time *rel)
|
||||
@@ -101,17 +121,6 @@ void timelib_time_tz_abbr_update(timelib_time* tm, char* tz_abbr)
|
||||
}
|
||||
}
|
||||
|
||||
void timelib_time_dtor(timelib_time* t)
|
||||
{
|
||||
TIMELIB_TIME_FREE(t->tz_abbr);
|
||||
TIMELIB_TIME_FREE(t);
|
||||
}
|
||||
|
||||
void timelib_rel_time_dtor(timelib_rel_time* t)
|
||||
{
|
||||
TIMELIB_TIME_FREE(t);
|
||||
}
|
||||
|
||||
timelib_time_offset* timelib_time_offset_ctor(void)
|
||||
{
|
||||
timelib_time_offset *t;
|
||||
@@ -126,55 +135,6 @@ void timelib_time_offset_dtor(timelib_time_offset* t)
|
||||
TIMELIB_TIME_FREE(t);
|
||||
}
|
||||
|
||||
timelib_tzinfo* timelib_tzinfo_ctor(char *name)
|
||||
{
|
||||
timelib_tzinfo *t;
|
||||
t = timelib_calloc(1, sizeof(timelib_tzinfo));
|
||||
t->name = timelib_strdup(name);
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
timelib_tzinfo *timelib_tzinfo_clone(timelib_tzinfo *tz)
|
||||
{
|
||||
timelib_tzinfo *tmp = timelib_tzinfo_ctor(tz->name);
|
||||
tmp->bit32.ttisgmtcnt = tz->bit32.ttisgmtcnt;
|
||||
tmp->bit32.ttisstdcnt = tz->bit32.ttisstdcnt;
|
||||
tmp->bit32.leapcnt = tz->bit32.leapcnt;
|
||||
tmp->bit32.timecnt = tz->bit32.timecnt;
|
||||
tmp->bit32.typecnt = tz->bit32.typecnt;
|
||||
tmp->bit32.charcnt = tz->bit32.charcnt;
|
||||
|
||||
tmp->trans = (int32_t *) timelib_malloc(tz->bit32.timecnt * sizeof(int32_t));
|
||||
tmp->trans_idx = (unsigned char*) timelib_malloc(tz->bit32.timecnt * sizeof(unsigned char));
|
||||
memcpy(tmp->trans, tz->trans, tz->bit32.timecnt * sizeof(int32_t));
|
||||
memcpy(tmp->trans_idx, tz->trans_idx, tz->bit32.timecnt * sizeof(unsigned char));
|
||||
|
||||
tmp->type = (ttinfo*) timelib_malloc(tz->bit32.typecnt * sizeof(struct ttinfo));
|
||||
memcpy(tmp->type, tz->type, tz->bit32.typecnt * sizeof(struct ttinfo));
|
||||
|
||||
tmp->timezone_abbr = (char*) timelib_malloc(tz->bit32.charcnt);
|
||||
memcpy(tmp->timezone_abbr, tz->timezone_abbr, tz->bit32.charcnt);
|
||||
|
||||
tmp->leap_times = (tlinfo*) timelib_malloc(tz->bit32.leapcnt * sizeof(tlinfo));
|
||||
memcpy(tmp->leap_times, tz->leap_times, tz->bit32.leapcnt * sizeof(tlinfo));
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
void timelib_tzinfo_dtor(timelib_tzinfo *tz)
|
||||
{
|
||||
TIMELIB_TIME_FREE(tz->name);
|
||||
TIMELIB_TIME_FREE(tz->trans);
|
||||
TIMELIB_TIME_FREE(tz->trans_idx);
|
||||
TIMELIB_TIME_FREE(tz->type);
|
||||
TIMELIB_TIME_FREE(tz->timezone_abbr);
|
||||
TIMELIB_TIME_FREE(tz->leap_times);
|
||||
TIMELIB_TIME_FREE(tz->location.comments);
|
||||
TIMELIB_TIME_FREE(tz);
|
||||
tz = NULL;
|
||||
}
|
||||
|
||||
char *timelib_get_tz_abbr_ptr(timelib_time *t)
|
||||
{
|
||||
if (!t->sse_uptodate) {
|
||||
@@ -218,9 +178,24 @@ timelib_long timelib_date_to_int(timelib_time *d, int *error)
|
||||
|
||||
void timelib_decimal_hour_to_hms(double h, int *hour, int *min, int *sec)
|
||||
{
|
||||
*hour = floor(h);
|
||||
*min = floor((h - *hour) * 60);
|
||||
*sec = (h - *hour - ((float) *min / 60)) * 3600;
|
||||
if (h > 0) {
|
||||
*hour = floor(h);
|
||||
*min = floor((h - *hour) * 60);
|
||||
*sec = (h - *hour - ((float) *min / 60)) * 3600;
|
||||
} else {
|
||||
*hour = ceil(h);
|
||||
*min = 0 - ceil((h - *hour) * 60);
|
||||
*sec = 0 - (h - *hour - ((float) *min / -60)) * 3600;
|
||||
}
|
||||
}
|
||||
|
||||
void timelib_hms_to_decimal_hour(int hour, int min, int sec, double *h)
|
||||
{
|
||||
if (hour > 0) {
|
||||
*h = ((double)hour + (double)min / 60 + (double)sec / 3600);
|
||||
} else {
|
||||
*h = ((double)hour - (double)min / 60 - (double)sec / 3600);
|
||||
}
|
||||
}
|
||||
|
||||
void timelib_dump_date(timelib_time *d, int options)
|
||||
@@ -230,8 +205,8 @@ void timelib_dump_date(timelib_time *d, int options)
|
||||
}
|
||||
printf("TS: %lld | %s%04lld-%02lld-%02lld %02lld:%02lld:%02lld",
|
||||
d->sse, d->y < 0 ? "-" : "", TIMELIB_LLABS(d->y), d->m, d->d, d->h, d->i, d->s);
|
||||
if (d->f > +0.0) {
|
||||
printf(" %.6f", d->f);
|
||||
if (d->us > 0) {
|
||||
printf(" 0.%06lld", d->us);
|
||||
}
|
||||
|
||||
if (d->is_localtime) {
|
||||
@@ -260,8 +235,8 @@ void timelib_dump_date(timelib_time *d, int options)
|
||||
if (d->have_relative) {
|
||||
printf("%3lldY %3lldM %3lldD / %3lldH %3lldM %3lldS",
|
||||
d->relative.y, d->relative.m, d->relative.d, d->relative.h, d->relative.i, d->relative.s);
|
||||
if (d->relative.f) {
|
||||
printf(" %6f", d->relative.f);
|
||||
if (d->relative.us) {
|
||||
printf(" 0.%06lld", d->relative.us);
|
||||
}
|
||||
if (d->relative.first_last_day_of != 0) {
|
||||
switch (d->relative.first_last_day_of) {
|
||||
@@ -310,36 +285,3 @@ void timelib_dump_rel_time(timelib_rel_time *d)
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
timelib_long timelib_parse_tz_cor(char **ptr)
|
||||
{
|
||||
char *begin = *ptr, *end;
|
||||
timelib_long tmp;
|
||||
|
||||
while (isdigit(**ptr) || **ptr == ':') {
|
||||
++*ptr;
|
||||
}
|
||||
end = *ptr;
|
||||
switch (end - begin) {
|
||||
case 1: /* H */
|
||||
case 2: /* HH */
|
||||
return HOUR(strtol(begin, NULL, 10));
|
||||
break;
|
||||
case 3: /* H:M */
|
||||
case 4: /* H:MM, HH:M, HHMM */
|
||||
if (begin[1] == ':') {
|
||||
tmp = HOUR(strtol(begin, NULL, 10)) + strtol(begin + 2, NULL, 10);
|
||||
return tmp;
|
||||
} else if (begin[2] == ':') {
|
||||
tmp = HOUR(strtol(begin, NULL, 10)) + strtol(begin + 3, NULL, 10);
|
||||
return tmp;
|
||||
} else {
|
||||
tmp = strtol(begin, NULL, 10);
|
||||
return HOUR(tmp / 100) + tmp % 100;
|
||||
}
|
||||
case 5: /* HH:MM */
|
||||
tmp = HOUR(strtol(begin, NULL, 10)) + strtol(begin + 3, NULL, 10);
|
||||
return tmp;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
+772
-50
@@ -25,11 +25,283 @@
|
||||
#ifndef __TIMELIB_H__
|
||||
#define __TIMELIB_H__
|
||||
|
||||
#include "timelib_structs.h"
|
||||
#if HAVE_LIMITS_H
|
||||
#include <limits.h>
|
||||
#ifdef HAVE_TIMELIB_CONFIG_H
|
||||
# include "timelib_config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <limits.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
# ifndef HAVE_INT32_T
|
||||
# if SIZEOF_INT == 4
|
||||
typedef int int32_t;
|
||||
# elif SIZEOF_LONG == 4
|
||||
typedef long int int32_t;
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# ifndef HAVE_UINT32_T
|
||||
# if SIZEOF_INT == 4
|
||||
typedef unsigned int uint32_t;
|
||||
# elif SIZEOF_LONG == 4
|
||||
typedef unsigned long int uint32_t;
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#ifdef _WIN32
|
||||
# if _MSC_VER >= 1600
|
||||
# include <stdint.h>
|
||||
# endif
|
||||
# ifndef SIZEOF_INT
|
||||
# define SIZEOF_INT 4
|
||||
# endif
|
||||
# ifndef SIZEOF_LONG
|
||||
# define SIZEOF_LONG 4
|
||||
# endif
|
||||
# ifndef int32_t
|
||||
typedef __int32 int32_t;
|
||||
# endif
|
||||
# ifndef uint32_t
|
||||
typedef unsigned __int32 uint32_t;
|
||||
# endif
|
||||
# ifndef int64_t
|
||||
typedef __int64 int64_t;
|
||||
# endif
|
||||
# ifndef uint64_t
|
||||
typedef unsigned __int64 uint64_t;
|
||||
# endif
|
||||
# ifndef PRId32
|
||||
# define PRId32 "I32d"
|
||||
# endif
|
||||
# ifndef PRIu32
|
||||
# define PRIu32 "I32u"
|
||||
# endif
|
||||
# ifndef PRId64
|
||||
# define PRId64 "I64d"
|
||||
# endif
|
||||
# ifndef PRIu64
|
||||
# define PRIu64 "I64u"
|
||||
# endif
|
||||
# ifndef INT32_MAX
|
||||
#define INT32_MAX _I32_MAX
|
||||
# endif
|
||||
# ifndef INT32_MIN
|
||||
#define INT32_MIN ((int32_t)_I32_MIN)
|
||||
# endif
|
||||
# ifndef UINT32_MAX
|
||||
#define UINT32_MAX _UI32_MAX
|
||||
# endif
|
||||
# ifndef INT64_MIN
|
||||
#define INT64_MIN ((int64_t)_I64_MIN)
|
||||
# endif
|
||||
# ifndef INT64_MAX
|
||||
#define INT64_MAX _I64_MAX
|
||||
# endif
|
||||
# ifndef UINT64_MAX
|
||||
#define UINT64_MAX _UI64_MAX
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if (defined(__x86_64__) || defined(__LP64__) || defined(_LP64) || defined(_WIN64)) && !defined(TIMELIB_FORCE_LONG32)
|
||||
typedef int64_t timelib_long;
|
||||
typedef uint64_t timelib_ulong;
|
||||
# define TIMELIB_LONG_MAX INT64_MAX
|
||||
# define TIMELIB_LONG_MIN INT64_MIN
|
||||
# define TIMELIB_ULONG_MAX UINT64_MAX
|
||||
# define TIMELIB_LONG_FMT "%" PRId64
|
||||
# define TIMELIB_ULONG_FMT "%" PRIu64
|
||||
#else
|
||||
typedef int32_t timelib_long;
|
||||
typedef uint32_t timelib_ulong;
|
||||
# define TIMELIB_LONG_MAX INT32_MAX
|
||||
# define TIMELIB_LONG_MIN INT32_MIN
|
||||
# define TIMELIB_ULONG_MAX UINT32_MAX
|
||||
# define TIMELIB_LONG_FMT "%" PRId32
|
||||
# define TIMELIB_ULONG_FMT "%" PRIu32
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
typedef uint64_t timelib_ull;
|
||||
typedef int64_t timelib_sll;
|
||||
# define TIMELIB_LL_CONST(n) n ## i64
|
||||
#else
|
||||
typedef unsigned long long timelib_ull;
|
||||
typedef signed long long timelib_sll;
|
||||
# define TIMELIB_LL_CONST(n) n ## ll
|
||||
#endif
|
||||
|
||||
typedef struct _ttinfo ttinfo;
|
||||
typedef struct _tlinfo tlinfo;
|
||||
|
||||
typedef struct _tlocinfo
|
||||
{
|
||||
char country_code[3];
|
||||
double latitude;
|
||||
double longitude;
|
||||
char *comments;
|
||||
} tlocinfo;
|
||||
|
||||
typedef struct _timelib_tzinfo
|
||||
{
|
||||
char *name;
|
||||
struct {
|
||||
uint32_t ttisgmtcnt;
|
||||
uint32_t ttisstdcnt;
|
||||
uint32_t leapcnt;
|
||||
uint32_t timecnt;
|
||||
uint32_t typecnt;
|
||||
uint32_t charcnt;
|
||||
} bit32;
|
||||
struct {
|
||||
uint64_t ttisgmtcnt;
|
||||
uint64_t ttisstdcnt;
|
||||
uint64_t leapcnt;
|
||||
uint64_t timecnt;
|
||||
uint64_t typecnt;
|
||||
uint64_t charcnt;
|
||||
} bit64;
|
||||
|
||||
int32_t *trans;
|
||||
unsigned char *trans_idx;
|
||||
|
||||
ttinfo *type;
|
||||
char *timezone_abbr;
|
||||
|
||||
tlinfo *leap_times;
|
||||
unsigned char bc;
|
||||
tlocinfo location;
|
||||
} timelib_tzinfo;
|
||||
|
||||
typedef struct _timelib_rel_time {
|
||||
timelib_sll y, m, d; /* Years, Months and Days */
|
||||
timelib_sll h, i, s; /* Hours, mInutes and Seconds */
|
||||
timelib_sll us; /* Microseconds */
|
||||
|
||||
int weekday; /* Stores the day in 'next monday' */
|
||||
int weekday_behavior; /* 0: the current day should *not* be counted when advancing forwards; 1: the current day *should* be counted */
|
||||
|
||||
int first_last_day_of;
|
||||
int invert; /* Whether the difference should be inverted */
|
||||
timelib_sll days; /* Contains the number of *days*, instead of Y-M-D differences */
|
||||
|
||||
struct {
|
||||
unsigned int type;
|
||||
timelib_sll amount;
|
||||
} special;
|
||||
|
||||
unsigned int have_weekday_relative, have_special_relative;
|
||||
} timelib_rel_time;
|
||||
|
||||
typedef struct _timelib_time_offset {
|
||||
int32_t offset;
|
||||
unsigned int leap_secs;
|
||||
unsigned int is_dst;
|
||||
char *abbr;
|
||||
timelib_sll transition_time;
|
||||
} timelib_time_offset;
|
||||
|
||||
typedef struct _timelib_time {
|
||||
timelib_sll y, m, d; /* Year, Month, Day */
|
||||
timelib_sll h, i, s; /* Hour, mInute, Second */
|
||||
timelib_sll us; /* Microseconds */
|
||||
int z; /* UTC offset in seconds */
|
||||
char *tz_abbr; /* Timezone abbreviation (display only) */
|
||||
timelib_tzinfo *tz_info; /* Timezone structure */
|
||||
signed int dst; /* Flag if we were parsing a DST zone */
|
||||
timelib_rel_time relative;
|
||||
|
||||
timelib_sll sse; /* Seconds since epoch */
|
||||
|
||||
unsigned int have_time, have_date, have_zone, have_relative, have_weeknr_day;
|
||||
|
||||
unsigned int sse_uptodate; /* !0 if the sse member is up to date with the date/time members */
|
||||
unsigned int tim_uptodate; /* !0 if the date/time members are up to date with the sse member */
|
||||
unsigned int is_localtime; /* 1 if the current struct represents localtime, 0 if it is in GMT */
|
||||
unsigned int zone_type; /* 1 time offset,
|
||||
* 3 TimeZone identifier,
|
||||
* 2 TimeZone abbreviation */
|
||||
} timelib_time;
|
||||
|
||||
typedef struct _timelib_abbr_info {
|
||||
timelib_sll utc_offset;
|
||||
char *abbr;
|
||||
int dst;
|
||||
} timelib_abbr_info;
|
||||
|
||||
#define TIMELIB_WARN_MASK 0x1ff
|
||||
#define TIMELIB_ERR_MASK 0x2ff
|
||||
|
||||
#define TIMELIB_WARN_DOUBLE_TZ 0x101
|
||||
#define TIMELIB_WARN_INVALID_TIME 0x102
|
||||
#define TIMELIB_WARN_INVALID_DATE 0x103
|
||||
#define TIMELIB_WARN_TRAILING_DATA 0x11a
|
||||
|
||||
#define TIMELIB_ERR_DOUBLE_TZ 0x201
|
||||
#define TIMELIB_ERR_TZID_NOT_FOUND 0x202
|
||||
#define TIMELIB_ERR_DOUBLE_TIME 0x203
|
||||
#define TIMELIB_ERR_DOUBLE_DATE 0x204
|
||||
#define TIMELIB_ERR_UNEXPECTED_CHARACTER 0x205
|
||||
#define TIMELIB_ERR_EMPTY_STRING 0x206
|
||||
#define TIMELIB_ERR_UNEXPECTED_DATA 0x207
|
||||
#define TIMELIB_ERR_NO_TEXTUAL_DAY 0x208
|
||||
#define TIMELIB_ERR_NO_TWO_DIGIT_DAY 0x209
|
||||
#define TIMELIB_ERR_NO_THREE_DIGIT_DAY_OF_YEAR 0x20a
|
||||
#define TIMELIB_ERR_NO_TWO_DIGIT_MONTH 0x20b
|
||||
#define TIMELIB_ERR_NO_TEXTUAL_MONTH 0x20c
|
||||
#define TIMELIB_ERR_NO_TWO_DIGIT_YEAR 0x20d
|
||||
#define TIMELIB_ERR_NO_FOUR_DIGIT_YEAR 0x20e
|
||||
#define TIMELIB_ERR_NO_TWO_DIGIT_HOUR 0x20f
|
||||
#define TIMELIB_ERR_HOUR_LARGER_THAN_12 0x210
|
||||
#define TIMELIB_ERR_MERIDIAN_BEFORE_HOUR 0x211
|
||||
#define TIMELIB_ERR_NO_MERIDIAN 0x212
|
||||
#define TIMELIB_ERR_NO_TWO_DIGIT_MINUTE 0x213
|
||||
#define TIMELIB_ERR_NO_TWO_DIGIT_SECOND 0x214
|
||||
#define TIMELIB_ERR_NO_SIX_DIGIT_MICROSECOND 0x215
|
||||
#define TIMELIB_ERR_NO_SEP_SYMBOL 0x216
|
||||
#define TIMELIB_ERR_EXPECTED_ESCAPE_CHAR 0x217
|
||||
#define TIMELIB_ERR_NO_ESCAPED_CHAR 0x218
|
||||
#define TIMELIB_ERR_WRONG_FORMAT_SEP 0x219
|
||||
#define TIMELIB_ERR_TRAILING_DATA 0x21a
|
||||
#define TIMELIB_ERR_DATA_MISSING 0x21b
|
||||
|
||||
#define TIMELIB_ZONETYPE_OFFSET 1
|
||||
#define TIMELIB_ZONETYPE_ABBR 2
|
||||
#define TIMELIB_ZONETYPE_ID 3
|
||||
|
||||
typedef struct _timelib_error_message {
|
||||
int error_code;
|
||||
int position;
|
||||
char character;
|
||||
char *message;
|
||||
} timelib_error_message;
|
||||
|
||||
typedef struct _timelib_error_container {
|
||||
timelib_error_message *error_messages;
|
||||
timelib_error_message *warning_messages;
|
||||
int error_count;
|
||||
int warning_count;
|
||||
} timelib_error_container;
|
||||
|
||||
typedef struct _timelib_tz_lookup_table {
|
||||
char *name;
|
||||
int type;
|
||||
float gmtoffset;
|
||||
char *full_tz_name;
|
||||
} timelib_tz_lookup_table;
|
||||
|
||||
typedef struct _timelib_tzdb_index_entry {
|
||||
char *id;
|
||||
unsigned int pos;
|
||||
} timelib_tzdb_index_entry;
|
||||
|
||||
typedef struct _timelib_tzdb {
|
||||
char *version;
|
||||
int index_size;
|
||||
const timelib_tzdb_index_entry *index;
|
||||
const unsigned char *data;
|
||||
} timelib_tzdb;
|
||||
|
||||
#ifndef timelib_malloc
|
||||
# define timelib_malloc malloc
|
||||
# define timelib_realloc realloc
|
||||
@@ -38,8 +310,9 @@
|
||||
# define timelib_free free
|
||||
#endif
|
||||
|
||||
#define TIMELIB_VERSION 201605
|
||||
#define TIMELIB_ASCII_VERSION "2016.05"
|
||||
#define TIMELIB_VERSION 201705
|
||||
#define TIMELIB_EXTENDED_VERSION 20170509
|
||||
#define TIMELIB_ASCII_VERSION "2017.05beta9"
|
||||
|
||||
#define TIMELIB_NONE 0x00
|
||||
#define TIMELIB_OVERRIDE_TIME 0x01
|
||||
@@ -47,119 +320,568 @@
|
||||
|
||||
#define TIMELIB_UNSET -99999
|
||||
|
||||
#define TIMELIB_SPECIAL_WEEKDAY 0x01
|
||||
#define TIMELIB_SPECIAL_DAY_OF_WEEK_IN_MONTH 0x02
|
||||
#define TIMELIB_SPECIAL_LAST_DAY_OF_WEEK_IN_MONTH 0x03
|
||||
/* An entry for each of these error codes is also in the
|
||||
* timelib_error_messages array in timelib.c */
|
||||
#define TIMELIB_ERROR_NO_ERROR 0x00
|
||||
#define TIMELIB_ERROR_CANNOT_ALLOCATE 0x01
|
||||
#define TIMELIB_ERROR_CORRUPT_TRANSITIONS_DONT_INCREASE 0x02
|
||||
#define TIMELIB_ERROR_CORRUPT_NO_64BIT_PREAMBLE 0x03
|
||||
#define TIMELIB_ERROR_CORRUPT_NO_ABBREVIATION 0x04
|
||||
#define TIMELIB_ERROR_UNSUPPORTED_VERSION 0x05
|
||||
#define TIMELIB_ERROR_NO_SUCH_TIMEZONE 0x06
|
||||
|
||||
#define TIMELIB_SPECIAL_FIRST_DAY_OF_MONTH 0x01
|
||||
#define TIMELIB_SPECIAL_LAST_DAY_OF_MONTH 0x02
|
||||
|
||||
#ifndef LONG_MAX
|
||||
#define LONG_MAX 2147483647L
|
||||
#endif
|
||||
|
||||
#ifndef LONG_MIN
|
||||
#define LONG_MIN (- LONG_MAX - 1)
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && !defined(strcasecmp)
|
||||
#define strcasecmp stricmp
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && !defined(strncasecmp)
|
||||
#define strncasecmp strnicmp
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Function pointers */
|
||||
typedef timelib_tzinfo* (*timelib_tz_get_wrapper)(char *tzname, const timelib_tzdb *tzdb);
|
||||
typedef timelib_tzinfo* (*timelib_tz_get_wrapper)(char *tzname, const timelib_tzdb *tzdb, int *error_code);
|
||||
|
||||
/* From dow.c */
|
||||
/* Calculates the day of the week from y, m, and d. 0=Sunday..6=Saturday */
|
||||
timelib_sll timelib_day_of_week(timelib_sll y, timelib_sll m, timelib_sll d);
|
||||
|
||||
/* Calculates the day of the ISO week from y, m, and d. 1=Monday, 7=Sunday */
|
||||
timelib_sll timelib_iso_day_of_week(timelib_sll y, timelib_sll m, timelib_sll d);
|
||||
|
||||
/* Calculates the day of the year according to y-m-d. 0=Jan 1st..364/365=Dec
|
||||
* 31st */
|
||||
timelib_sll timelib_day_of_year(timelib_sll y, timelib_sll m, timelib_sll d);
|
||||
timelib_sll timelib_daynr_from_weeknr(timelib_sll y, timelib_sll w, timelib_sll d);
|
||||
|
||||
/* Calculates the day of the year according to y-w-dow. 0..364/365 */
|
||||
timelib_sll timelib_daynr_from_weeknr(timelib_sll iy, timelib_sll iw, timelib_sll id);
|
||||
|
||||
/* Calculates the number of days in month m for year y. 28..31 */
|
||||
timelib_sll timelib_days_in_month(timelib_sll y, timelib_sll m);
|
||||
|
||||
/* Calculates the ISO year and week from y, m, and d, into iw and iy */
|
||||
void timelib_isoweek_from_date(timelib_sll y, timelib_sll m, timelib_sll d, timelib_sll *iw, timelib_sll *iy);
|
||||
|
||||
/* Calculates the ISO year, week, and day of week from y, m, and d, into iy,
|
||||
* iw, and id */
|
||||
void timelib_isodate_from_date(timelib_sll y, timelib_sll m, timelib_sll d, timelib_sll *iy, timelib_sll *iw, timelib_sll *id);
|
||||
|
||||
/* Calculates the year, month, and day from iy, iw, and iw, into y, m, and d */
|
||||
void timelib_date_from_isodate(timelib_sll iy, timelib_sll iw, timelib_sll id, timelib_sll *y, timelib_sll *m, timelib_sll *d);
|
||||
|
||||
/* Returns true if h, i and s fit in the range 00:00:00..23:59:59, false
|
||||
* otherwise */
|
||||
int timelib_valid_time(timelib_sll h, timelib_sll i, timelib_sll s);
|
||||
|
||||
/* Returns true if m fits in the range 1..12, and d fits in the range
|
||||
* 1..<days-in-month> for year y */
|
||||
int timelib_valid_date(timelib_sll y, timelib_sll m, timelib_sll d);
|
||||
|
||||
/* From parse_date.re */
|
||||
|
||||
/* Parses the date/time string in 's' with length 'len' into the constituent
|
||||
* parts of timelib_time*.
|
||||
*
|
||||
* Depending on the contents of the string 's', not all elements might be
|
||||
* filled. You can check whether a specific element has been parsed by
|
||||
* comparing with the TIMELIB_UNSET define.
|
||||
*
|
||||
* If errors occur, this function keeps already parsed elements in the
|
||||
* returned timelib_time* value.
|
||||
*
|
||||
* If the **errors points to a timelib_error_container variable, warnings
|
||||
* and errors will be recorded. You are responsible for freeing the stored
|
||||
* information with timelib_error_container_dtor(). To see whether errors have
|
||||
* occured, inspect errors->errors_count. To see whether warnings have occured,
|
||||
* inspect errors->warnings_count.
|
||||
*
|
||||
* The returned timelib_time* value is dynamically allocated and should be
|
||||
* freed with timelib_time_dtor().
|
||||
*/
|
||||
timelib_time *timelib_strtotime(char *s, size_t len, timelib_error_container **errors, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_get_wrapper);
|
||||
|
||||
/* Parses the date/time string in 's' with length 'len' into the constituent
|
||||
* parts of timelib_time* according to the format in 'format'.
|
||||
*
|
||||
* Depending on the contents of the string 's', not all elements might be
|
||||
* filled. You can check whether a specific element has been parsed by
|
||||
* comparing with the TIMELIB_UNSET define.
|
||||
*
|
||||
* If errors occur, this function keeps already parsed elements in the
|
||||
* returned timelib_time* value.
|
||||
*
|
||||
* If the **errors points to a timelib_error_container variable, warnings
|
||||
* and errors will be recorded. You are responsible for freeing the stored
|
||||
* information with timelib_error_container_dtor(). To see whether errors have
|
||||
* occured, inspect errors->errors_count. To see whether warnings have occured,
|
||||
* inspect errors->warnings_count.
|
||||
*
|
||||
* The returned timelib_time* value is dynamically allocated and should be
|
||||
* freed with timelib_time_dtor().
|
||||
*/
|
||||
timelib_time *timelib_parse_from_format(char *format, char *s, size_t len, timelib_error_container **errors, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_get_wrapper);
|
||||
|
||||
/* Fills the gaps in the parsed timelib_time with information from the reference date/time in 'now'
|
||||
*
|
||||
* If any of the 'parsed' y, m, d, h, i or s parameters is unset (TIMELIB_UNSET):
|
||||
* - if microtime (us) is unset, then the us of the parsed time is set to 0.
|
||||
* - else if microtime (us) is unset and 'now'->'us' is set, use it, otherwise use 0.
|
||||
*
|
||||
* For either of the 'parsed' y, m, d, h, i, s, z (utc offset in seconds) or
|
||||
* dst is unset, set it to the corresponding value in 'now' if set, otherwise
|
||||
* set it to 0.
|
||||
*
|
||||
* It duplicates tz_abbr if unset in 'parsed' but set in 'now'.
|
||||
*
|
||||
* It duplicates tz_info if unset in 'parsed', but set in 'now' unless
|
||||
* TIMELIB_NO_CLONE is passed, in which case only the pointer in 'parsed' is
|
||||
* set to 'now'.
|
||||
*
|
||||
* If the option TIMELIB_OVERRIDE_TIME is passed and the parsed date/time has
|
||||
* no time portion, the function will ignore the time aspect in 'now' and
|
||||
* instead fill it with zeros.
|
||||
*/
|
||||
void timelib_fill_holes(timelib_time *parsed, timelib_time *now, int options);
|
||||
|
||||
/* Tries to convert a time zone abbreviation, gmtoffset and/or isdst flag
|
||||
* combination to a time zone identifier.
|
||||
*
|
||||
* If 'abbr' is either 'utc' or 'gmt' (case insensitve) then "UTC" is
|
||||
* returned.
|
||||
*
|
||||
* It first uses the data in the timezonemap.h file to find a matching
|
||||
* abbreviation/GMT offset combination. If not found, it uses the data in
|
||||
* fallbackmap.h to match only the GMT offset/isdst flag to try to find a
|
||||
* match. If nothing is found, NULL is returned.
|
||||
*
|
||||
* The returned char* is not duplicated, and should not be freed.
|
||||
*/
|
||||
char *timelib_timezone_id_from_abbr(const char *abbr, timelib_long gmtoffset, int isdst);
|
||||
|
||||
/* Returns an array of known time zone abbreviations
|
||||
*
|
||||
* This file is generated from the time zone database through the
|
||||
* gettzmapping.php scripts, which requires that an up-to-date time zone
|
||||
* database is used with the PHP binary that runs the script.
|
||||
*
|
||||
* Each item in the returned list contains the abbreviation, a flag whether
|
||||
* it's an abbreviation used with DST, the UTC offset in seconds, and the name
|
||||
* of the time zone identifier that this abbreviation belongs to.
|
||||
*
|
||||
* The order for each specific abbreviation is controlled through the
|
||||
* preference list in the gettzmapping.php script. Time zones that match the
|
||||
* pattern ±\d{2,4} are excluded
|
||||
*/
|
||||
const timelib_tz_lookup_table *timelib_timezone_abbreviations_list(void);
|
||||
timelib_long timelib_parse_tz_cor(char**);
|
||||
|
||||
/**
|
||||
* DEPRECATED, but still used by PHP.
|
||||
*/
|
||||
timelib_long timelib_parse_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_wrapper);
|
||||
|
||||
/* From parse_iso_intervals.re */
|
||||
|
||||
/**
|
||||
* Parses a subset of an ISO 8601 intervals specification string into its
|
||||
* constituent parts.
|
||||
*
|
||||
* If the **errors points to a timelib_error_container variable, warnings
|
||||
* and errors will be recorded. You are responsible for freeing the stored
|
||||
* information with timelib_error_container_dtor(). To see whether errors have
|
||||
* occured, inspect errors->errors_count. To see whether warnings have occured,
|
||||
* inspect errors->warnings_count.
|
||||
*/
|
||||
void timelib_strtointerval(char *s, size_t len,
|
||||
timelib_time **begin, timelib_time **end,
|
||||
timelib_rel_time **period, int *recurrences,
|
||||
struct timelib_error_container **errors);
|
||||
timelib_error_container **errors);
|
||||
|
||||
|
||||
/* From tm2unixtime.c */
|
||||
|
||||
/**
|
||||
* Uses the y/m/d/h/i/s fields to calculate and store the equivalent timestamp
|
||||
* in the sse field.
|
||||
*
|
||||
* It uses the time zone information associated with 'time' to account for the
|
||||
* right UTC offset and/or DST rules. You can associate time zone information
|
||||
* with the timelib_set_timezone_* functions (see below).
|
||||
*
|
||||
* If the type is 'TIMELIB_ZONETYPE_ID' and there is no associated tzinfo, it
|
||||
* will use the second argument 'tzi' to provide the rules necessary to
|
||||
* calculate the right timestamp.
|
||||
*/
|
||||
void timelib_update_ts(timelib_time* time, timelib_tzinfo* tzi);
|
||||
|
||||
/**
|
||||
* Takes the information from the y/m/d/h/i/s fields and makes sure their
|
||||
* values are in the right range.
|
||||
*
|
||||
* If a value under- or overflows it will adjust the larger measure up (or
|
||||
* down). It also takes into account leap days.
|
||||
*/
|
||||
void timelib_do_normalize(timelib_time *base);
|
||||
|
||||
/**
|
||||
* Takes the information from the y/m/d/h/i/s fields of 'rt' and makes sure
|
||||
* their values are in the right range.
|
||||
*
|
||||
* If a value under- or overflows it will adjust the larger measure up (or
|
||||
* down). As this function operates on a *relative date/time*, it also takes
|
||||
* into account leap days and correctly accounts for the difference depending
|
||||
* on the base date/time in 'base'.
|
||||
*/
|
||||
void timelib_do_rel_normalize(timelib_time *base, timelib_rel_time *rt);
|
||||
|
||||
/* From unixtime2tm.c */
|
||||
int timelib_apply_localtime(timelib_time *t, unsigned int localtime);
|
||||
|
||||
/**
|
||||
* Takes the unix timestamp in seconds from 'ts' and populates the y/m/d/h/i/s
|
||||
* fields of 'tm' without taking time zones into account
|
||||
*/
|
||||
void timelib_unixtime2gmt(timelib_time* tm, timelib_sll ts);
|
||||
|
||||
/**
|
||||
* Takes the Unix timestamp from 'ts', and calculates the y/m/d/h/i/s fields
|
||||
* according to the time zone information attached to 'tm'.
|
||||
*/
|
||||
void timelib_unixtime2local(timelib_time *tm, timelib_sll ts);
|
||||
|
||||
/**
|
||||
* Takes the Unix timestamp stored in 'tm', and calculates the y/m/d/h/i/s
|
||||
* fields according to the time zone information attached to 'tm'.
|
||||
*/
|
||||
void timelib_update_from_sse(timelib_time *tm);
|
||||
|
||||
/**
|
||||
* Attaches the UTC offset as time zone information to 't'.
|
||||
*
|
||||
* 'utc_offset' is in seconds East of UTC.
|
||||
*/
|
||||
void timelib_set_timezone_from_offset(timelib_time *t, timelib_sll utc_offset);
|
||||
|
||||
/**
|
||||
* Attaches the information from 'abbr_info' as time zone information to 't'.
|
||||
*
|
||||
* The timelib_abbr_info struct contains an abbreviation ('abbr') which string
|
||||
* value is duplicated, as well as a 'utc_offset' and 'dst' flag. It only
|
||||
* supports a 'dst' change over of 1 hour.
|
||||
*/
|
||||
void timelib_set_timezone_from_abbr(timelib_time *t, timelib_abbr_info abbr_info);
|
||||
|
||||
/**
|
||||
* Attaches the time zone information in 'tz' to to 't'.
|
||||
*
|
||||
* It fetches the right UTC offset that is currently stored in the time
|
||||
* stamp field in 't' ('sse'), and assigns that to the 'z' field and 'dst'
|
||||
* field (whether DST is in effect at the time). It also sets the current
|
||||
* abbrevation to the 'tz_addr' field, making sure that if a value was already
|
||||
* set it was freed.
|
||||
*
|
||||
* The time zone information in 'tz' is *not* duplicated into the 't' field so
|
||||
* it should not be freed until all timelib_time* variables have been freed as
|
||||
* well.
|
||||
*/
|
||||
void timelib_set_timezone(timelib_time *t, timelib_tzinfo *tz);
|
||||
|
||||
/* From parse_tz.c */
|
||||
int timelib_timezone_id_is_valid(char *timezone, const timelib_tzdb *tzdb);
|
||||
timelib_tzinfo *timelib_parse_tzfile(char *timezone, const timelib_tzdb *tzdb);
|
||||
int timelib_timestamp_is_in_dst(timelib_sll ts, timelib_tzinfo *tz);
|
||||
timelib_time_offset *timelib_get_time_zone_info(timelib_sll ts, timelib_tzinfo *tz);
|
||||
timelib_sll timelib_get_current_offset(timelib_time *t);
|
||||
void timelib_dump_tzinfo(timelib_tzinfo *tz);
|
||||
const timelib_tzdb *timelib_builtin_db(void);
|
||||
const timelib_tzdb_index_entry *timelib_timezone_builtin_identifiers_list(int *count);
|
||||
timelib_long timelib_parse_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_wrapper);
|
||||
|
||||
/* From timelib.c */
|
||||
timelib_tzinfo* timelib_tzinfo_ctor(char *name);
|
||||
void timelib_time_tz_abbr_update(timelib_time* tm, char* tz_abbr);
|
||||
void timelib_time_tz_name_update(timelib_time* tm, char* tz_name);
|
||||
/**
|
||||
* Returns whether the time zone ID 'timezone' is available in the time zone
|
||||
* database as pointed to be 'tzdb'.
|
||||
*/
|
||||
int timelib_timezone_id_is_valid(char *timezone, const timelib_tzdb *tzdb);
|
||||
|
||||
/**
|
||||
* Converts the binary stored time zone information from 'tzdb' for the time
|
||||
* zone 'timeozne' into a structure the library can use for calculations.
|
||||
*
|
||||
* The function can be used on both timelib_builtin_db as well as a time zone
|
||||
* db as opened by timelib_zoneinfo.
|
||||
* The function will return null upon failure, and also set an error code
|
||||
* through 'error_code'. 'error_code' must not be a null pointer. The error
|
||||
* code is one of the TIMELIB_ERROR_* constants as listed above. These error
|
||||
* constants can be converted into a string by timelib_get_error_message.
|
||||
*
|
||||
* This function allocates memory for the new time zone structure, which must
|
||||
* be freed after use. Although it is recommended that a cache of each used
|
||||
* time zone is kept.
|
||||
*/
|
||||
timelib_tzinfo *timelib_parse_tzfile(char *timezone, const timelib_tzdb *tzdb, int *error_code);
|
||||
|
||||
/**
|
||||
* Frees up the resources allocated by 'timelib_parse_tzfile'.
|
||||
*/
|
||||
void timelib_tzinfo_dtor(timelib_tzinfo *tz);
|
||||
|
||||
/**
|
||||
* Deep-clones a timelib_tzinfo structure.
|
||||
*
|
||||
* This allocates resources that need to be freed with 'timelib_tzinfo_dtor'
|
||||
*/
|
||||
timelib_tzinfo* timelib_tzinfo_clone(timelib_tzinfo *tz);
|
||||
|
||||
/**
|
||||
* Returns whether DST is active with time zone 'tz' for the time stamp 'ts'.
|
||||
*
|
||||
* Returns 0 if DST is not active, 1 if DST is active, or -1 if no transitions
|
||||
* were available through 'tz'.
|
||||
*/
|
||||
int timelib_timestamp_is_in_dst(timelib_sll ts, timelib_tzinfo *tz);
|
||||
|
||||
/**
|
||||
* Returns offset information with time zone 'tz' for the time stamp 'ts'.
|
||||
*
|
||||
* The returned information contains: the offset in seconds East of UTC (in
|
||||
* 'offset'), whether DST is active ('is_dst'), what the current time zone
|
||||
* abbreviation is ('abbr') and the transition time that got to this state (in
|
||||
* 'transistion_time');
|
||||
*/
|
||||
timelib_time_offset *timelib_get_time_zone_info(timelib_sll ts, timelib_tzinfo *tz);
|
||||
|
||||
/**
|
||||
* Returns the UTC offset currently applicable for the information stored in 't'.
|
||||
*
|
||||
* The value returned is the UTC offset in seconds East.
|
||||
*/
|
||||
timelib_sll timelib_get_current_offset(timelib_time *t);
|
||||
|
||||
/**
|
||||
* Displays debugging information about the time zone information in 'tz'.
|
||||
*/
|
||||
void timelib_dump_tzinfo(timelib_tzinfo *tz);
|
||||
|
||||
/**
|
||||
* Returns a pointer to the built-in time zone database.
|
||||
*
|
||||
* You must *not* free the returned pointer as it is part of the text segment.
|
||||
*/
|
||||
const timelib_tzdb *timelib_builtin_db(void);
|
||||
|
||||
/**
|
||||
* Returns a pointer to the start of an array containing a list of timezone identifiers.
|
||||
*
|
||||
* The amount of entries in the array is returned through the 'count' OUT parameter.
|
||||
*
|
||||
* Each entry contains the time zone ID ('id' field), and the position within the time zone
|
||||
* information ('pos' field). The pos field should not be used.
|
||||
*/
|
||||
const timelib_tzdb_index_entry *timelib_timezone_identifiers_list(timelib_tzdb *tzdb, int *count);
|
||||
|
||||
/* From parse_zoneinfo.c */
|
||||
|
||||
/**
|
||||
* Scans the directory and subdirectories of 'directory' for valid time zone files and builds
|
||||
* a time zone database out of these files.
|
||||
*
|
||||
* Typically, the directory should point to '/usr/share/zoneinfo'.
|
||||
*
|
||||
* Unlike 'timelib_builtin_db', the return value of this function must be freed
|
||||
* with the 'timelib_zoneinfo_dtor' function.
|
||||
*/
|
||||
timelib_tzdb *timelib_zoneinfo(char *directory);
|
||||
|
||||
/**
|
||||
* Frees up the resources as created through 'timelib_zoneinfo'.
|
||||
*
|
||||
* This function must be used to free up all the resources that have been
|
||||
* allocated while calling 'timelib_zoneinfo'.
|
||||
*/
|
||||
void timelib_zoneinfo_dtor(timelib_tzdb *tzdb);
|
||||
|
||||
/* From timelib.c */
|
||||
|
||||
/**
|
||||
* Returns a static string containing an error message belonging to a specific
|
||||
* error code.
|
||||
*/
|
||||
const char *timelib_get_error_message(int error_code);
|
||||
|
||||
/**
|
||||
* Allocates resources for the relative time structure.
|
||||
*
|
||||
* Must be freed with 'timelib_rel_time_dtor'.
|
||||
*/
|
||||
timelib_rel_time* timelib_rel_time_ctor(void);
|
||||
|
||||
/**
|
||||
* Frees up the resources as allocated through 'timelib_rel_time_ctor'.
|
||||
*/
|
||||
void timelib_rel_time_dtor(timelib_rel_time* t);
|
||||
|
||||
/**
|
||||
* Creates a new timelib_rel_time resource and copies over the information
|
||||
* from 'tz'.
|
||||
*
|
||||
* Must be freed with 'timelib_rel_time_dtor'.
|
||||
*/
|
||||
timelib_rel_time* timelib_rel_time_clone(timelib_rel_time *tz);
|
||||
|
||||
/**
|
||||
* Allocates resources for the time structure.
|
||||
*
|
||||
* Must be freed with 'timelib_time_dtor'.
|
||||
*/
|
||||
timelib_time* timelib_time_ctor(void);
|
||||
void timelib_time_set_option(timelib_time* tm, int option, void* option_value);
|
||||
void timelib_time_dtor(timelib_time* t);
|
||||
timelib_time* timelib_time_clone(timelib_time* orig);
|
||||
int timelib_time_compare(timelib_time *t1, timelib_time *t2);
|
||||
void timelib_set_fraction_from_timeval(timelib_time *t, struct timeval tp);
|
||||
|
||||
/**
|
||||
* Frees up the resources as allocated through 'timelib_time_ctor'.
|
||||
*/
|
||||
void timelib_time_dtor(timelib_time* t);
|
||||
|
||||
/**
|
||||
* Creates a new timelib_time resource and copies over the information
|
||||
* from 'orig'.
|
||||
*
|
||||
* Must be freed with 'timelib_time_dtor'.
|
||||
*/
|
||||
timelib_time* timelib_time_clone(timelib_time* orig);
|
||||
|
||||
/**
|
||||
* Compares two timelib_time structures and returns which one is earlier in
|
||||
* time.
|
||||
*
|
||||
* To decide which comes earlier it uses the 'sse' (Seconds Since Epoch) and
|
||||
* 'us' (microseconds) fields.
|
||||
*
|
||||
* Returns -1 if t1 < t2, 0 if t1 == t2, and -1 if t1 > t2.
|
||||
*/
|
||||
int timelib_time_compare(timelib_time *t1, timelib_time *t2);
|
||||
|
||||
/**
|
||||
* Allocates resources for the time offset structure.
|
||||
*
|
||||
* Must be freed with 'timelib_time_offset_dtor'.
|
||||
*/
|
||||
timelib_time_offset* timelib_time_offset_ctor(void);
|
||||
|
||||
/**
|
||||
* Frees up the resources as allocated through 'timelib_time_offset_ctor'.
|
||||
*/
|
||||
void timelib_time_offset_dtor(timelib_time_offset* t);
|
||||
|
||||
/**
|
||||
* Frees up the resources allocated while converting strings to timelib_time
|
||||
* structures with the timelib_strtotime and timelib_strtointerval functions.
|
||||
*/
|
||||
void timelib_error_container_dtor(timelib_error_container *errors);
|
||||
|
||||
/**
|
||||
* Converts the 'sse' value of 'd' to a timelib_long type.
|
||||
*
|
||||
* If the value fits in the TIMELIB_LONG_MIN and TIMELIB_LONG_MAX range, the
|
||||
* value is cast to (timelib_long) and returned. If *error is not a NULL
|
||||
* pointer, it will be set to 0.
|
||||
*
|
||||
* If the value does *not* fit in the range, the function returns 0 and if
|
||||
* *error is not a NULL pointer, it will be set to 1.
|
||||
*
|
||||
* timelib_long is a 32 bit signed long integer on 32 bit platforms, and a 64
|
||||
* bit signed long long integer on 64 bit platforms. In other words, it makes
|
||||
* sure that the value in 'sse' (which is always a signed long long 64 bit
|
||||
* integer) can be used safely outside of the library.
|
||||
*/
|
||||
timelib_long timelib_date_to_int(timelib_time *d, int *error);
|
||||
|
||||
/**
|
||||
* Displays debugging information about the date/time information stored in 'd'.
|
||||
*
|
||||
* 'options' is a bit field, where:
|
||||
* - 1 controls whether the relative time portion is shown.
|
||||
* - 2 controls whether the zone type is shown.
|
||||
*/
|
||||
void timelib_dump_date(timelib_time *d, int options);
|
||||
|
||||
/**
|
||||
* Displays debugging information about the relative time information stored
|
||||
* in 'd'.
|
||||
*/
|
||||
void timelib_dump_rel_time(timelib_rel_time *d);
|
||||
|
||||
/**
|
||||
* Converts a decimal hour into hour/min/sec components
|
||||
*/
|
||||
void timelib_decimal_hour_to_hms(double h, int *hour, int *min, int *sec);
|
||||
timelib_long timelib_parse_tz_cor(char **ptr);
|
||||
|
||||
/**
|
||||
* Converts hour/min/sec values into a decimal hour
|
||||
*/
|
||||
void timelib_hms_to_decimal_hour(int hour, int min, int sec, double *h);
|
||||
|
||||
/* from astro.c */
|
||||
double timelib_ts_to_juliandate(timelib_sll ts);
|
||||
|
||||
/**
|
||||
* Converts the Unix Epoch time stamp 'ts' to a Julian Day
|
||||
*
|
||||
* The value returned is the number of whole days since -4714-11-24T12:00:00 UTC
|
||||
* (in the proleptic Gregorian calendar):
|
||||
* https://en.wikipedia.org/wiki/Julian_day
|
||||
*/
|
||||
double timelib_ts_to_julianday(timelib_sll ts);
|
||||
|
||||
/**
|
||||
* Converts the Unix Epoch time stamp 'ts' to the J2000 epoch
|
||||
*
|
||||
* The value returned is the number of whole days since 2000-01-01T12:00:00
|
||||
* UTC: https://en.wikipedia.org/wiki/Epoch_(astronomy)#Julian_years_and_J2000
|
||||
*/
|
||||
double timelib_ts_to_j2000(timelib_sll ts);
|
||||
|
||||
/**
|
||||
* Calculates when the Sun is above a certain latitude.
|
||||
*
|
||||
* Parameters:
|
||||
* - time: A timelib_time time describing that needs to specific midnight for a
|
||||
* specific day.
|
||||
* - lon: The longitude of the observer (East positive, West negative).
|
||||
* - lat: The latitude of the observer (North positive, South negative).
|
||||
* - altit: The altitude. Set to -35/60 for rise/set, -6 for civil twilight,
|
||||
* -12 for nautical, and -18 for astronomical twilight.
|
||||
* - upper_limb: set to non-zero for rise/set calculations, and 0 for twilight
|
||||
* calculations.
|
||||
*
|
||||
* Out Parameters:
|
||||
* - h_rise: The decimal hour when the Sun rises
|
||||
* - h_set: The decimal hour when the Sun sets
|
||||
* - ts_rise: The Unix timestamp of the Sun rising
|
||||
* - ts_set: The Unix timestamp of the Sun setting
|
||||
* - ts_transit: The Unix timestmap of the Sun transitting through South
|
||||
*
|
||||
* Return Values:
|
||||
* - 0: The Sun rises and sets.
|
||||
* - +1: The Sun is always above the horizon. (ts_rise is set to ts_transit -
|
||||
* (12 * 3600); ts_set is set to ts_transit + (12 * 3600).
|
||||
* - -1: The Sun is awlays below the horizon. (ts_rise and ts_set are set
|
||||
* to ts_transit)
|
||||
*/
|
||||
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);
|
||||
|
||||
/* from interval.c */
|
||||
|
||||
/**
|
||||
* Calculates the difference between two times
|
||||
*
|
||||
* The result is a timelib_rel_time structure that describes how you can
|
||||
* convert from 'one' to 'two' with 'timelib_add'. This does *not* necessarily
|
||||
* mean that you can go from 'two' to 'one' by using 'timelib_sub' due to the
|
||||
* way months and days are calculated.
|
||||
*/
|
||||
timelib_rel_time *timelib_diff(timelib_time *one, timelib_time *two);
|
||||
|
||||
/**
|
||||
* Adds the relative time information 'interval' to the base time 't'.
|
||||
*
|
||||
* This can be a relative time as created by 'timelib_diff', but also by more
|
||||
* complex statements such as "next workday".
|
||||
*/
|
||||
timelib_time *timelib_add(timelib_time *t, timelib_rel_time *interval);
|
||||
|
||||
/**
|
||||
* Subtracts the relative time information 'interval' to the base time 't'.
|
||||
*
|
||||
* This can be a relative time as created by 'timelib_diff'. Unlike with
|
||||
* 'timelib_add', this does not support more complex statements such as "next
|
||||
* workday".
|
||||
*/
|
||||
timelib_time *timelib_sub(timelib_time *t, timelib_rel_time *interval);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -69,11 +69,14 @@ TL_CHECK_INT_TYPE(uint32_t)
|
||||
|
||||
dnl Check for headers needed by timelib
|
||||
AC_CHECK_HEADERS([ \
|
||||
sys/time.h \
|
||||
sys/types.h \
|
||||
inttypes.h \
|
||||
stdint.h \
|
||||
dirent.h \
|
||||
string.h \
|
||||
stdlib.h
|
||||
strings.h \
|
||||
unistd.h \
|
||||
io.h
|
||||
])
|
||||
|
||||
dnl Check for strtoll, atoll
|
||||
|
||||
@@ -0,0 +1,158 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2015 Derick Rethans
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef __TIMELIB_PRIVATE_H__
|
||||
#define __TIMELIB_PRIVATE_H__
|
||||
|
||||
#ifdef HAVE_SETLOCALE
|
||||
# include "locale.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_TIMELIB_CONFIG_H
|
||||
# include "timelib_config.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_TIME_H
|
||||
# include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
# ifdef HAVE_WINSOCK2_H
|
||||
# include <winsock2.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_STDINT_H)
|
||||
# include <stdint.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_IO_H
|
||||
# include <io.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_DIRENT_H
|
||||
# include <dirent.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#if HAVE_LIMITS_H
|
||||
#include <limits.h>
|
||||
#endif
|
||||
|
||||
#define TIMELIB_SECOND 1
|
||||
#define TIMELIB_MINUTE 2
|
||||
#define TIMELIB_HOUR 3
|
||||
#define TIMELIB_DAY 4
|
||||
#define TIMELIB_MONTH 5
|
||||
#define TIMELIB_YEAR 6
|
||||
#define TIMELIB_WEEKDAY 7
|
||||
#define TIMELIB_SPECIAL 8
|
||||
#define TIMELIB_MICROSEC 9
|
||||
|
||||
#define TIMELIB_SPECIAL_WEEKDAY 0x01
|
||||
#define TIMELIB_SPECIAL_DAY_OF_WEEK_IN_MONTH 0x02
|
||||
#define TIMELIB_SPECIAL_LAST_DAY_OF_WEEK_IN_MONTH 0x03
|
||||
|
||||
#define TIMELIB_SPECIAL_FIRST_DAY_OF_MONTH 0x01
|
||||
#define TIMELIB_SPECIAL_LAST_DAY_OF_MONTH 0x02
|
||||
|
||||
#define SECS_PER_ERA TIMELIB_LL_CONST(12622780800)
|
||||
#define SECS_PER_DAY 86400
|
||||
#define DAYS_PER_YEAR 365
|
||||
#define DAYS_PER_LYEAR 366
|
||||
/* 400*365 days + 97 leap days */
|
||||
#define DAYS_PER_LYEAR_PERIOD 146097
|
||||
#define YEARS_PER_LYEAR_PERIOD 400
|
||||
|
||||
#define TIMELIB_TZINFO_PHP 0x01
|
||||
#define TIMELIB_TZINFO_ZONEINFO 0x02
|
||||
|
||||
#define timelib_is_leap(y) ((y) % 4 == 0 && ((y) % 100 != 0 || (y) % 400 == 0))
|
||||
|
||||
#define TIMELIB_DEBUG(s) if (0) { s }
|
||||
|
||||
#define TIMELIB_TIME_FREE(m) \
|
||||
if (m) { \
|
||||
timelib_free(m); \
|
||||
m = NULL; \
|
||||
}
|
||||
|
||||
struct _ttinfo
|
||||
{
|
||||
int32_t offset;
|
||||
int isdst;
|
||||
unsigned int abbr_idx;
|
||||
|
||||
unsigned int isstdcnt;
|
||||
unsigned int isgmtcnt;
|
||||
};
|
||||
|
||||
struct _tlinfo
|
||||
{
|
||||
int32_t trans;
|
||||
int32_t offset;
|
||||
};
|
||||
|
||||
|
||||
#ifndef LONG_MAX
|
||||
#define LONG_MAX 2147483647L
|
||||
#endif
|
||||
|
||||
#ifndef LONG_MIN
|
||||
#define LONG_MIN (- LONG_MAX - 1)
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && !defined(strcasecmp)
|
||||
#define strcasecmp stricmp
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && !defined(strncasecmp)
|
||||
#define strncasecmp strnicmp
|
||||
#endif
|
||||
|
||||
/* From unixtime2tm.c */
|
||||
int timelib_apply_localtime(timelib_time *t, unsigned int localtime);
|
||||
|
||||
/* From parse_tz.c */
|
||||
void timelib_time_tz_abbr_update(timelib_time* tm, char* tz_abbr);
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,316 +0,0 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2015 Derick Rethans
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef __TIMELIB_STRUCTS_H__
|
||||
#define __TIMELIB_STRUCTS_H__
|
||||
|
||||
#ifdef HAVE_TIMELIB_CONFIG_H
|
||||
# include "timelib_config.h"
|
||||
#endif
|
||||
|
||||
#ifndef TIMELIB_OMIT_STDINT
|
||||
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INTTYPES_H)
|
||||
#include <inttypes.h>
|
||||
#elif defined(HAVE_STDINT_H)
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
# ifndef HAVE_INT32_T
|
||||
# if SIZEOF_INT == 4
|
||||
typedef int int32_t;
|
||||
# elif SIZEOF_LONG == 4
|
||||
typedef long int int32_t;
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# ifndef HAVE_UINT32_T
|
||||
# if SIZEOF_INT == 4
|
||||
typedef unsigned int uint32_t;
|
||||
# elif SIZEOF_LONG == 4
|
||||
typedef unsigned long int uint32_t;
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#ifdef _WIN32
|
||||
# if _MSC_VER >= 1600
|
||||
# include <stdint.h>
|
||||
# endif
|
||||
# ifndef SIZEOF_INT
|
||||
# define SIZEOF_INT 4
|
||||
# endif
|
||||
# ifndef SIZEOF_LONG
|
||||
# define SIZEOF_LONG 4
|
||||
# endif
|
||||
# ifndef int32_t
|
||||
typedef __int32 int32_t;
|
||||
# endif
|
||||
# ifndef uint32_t
|
||||
typedef unsigned __int32 uint32_t;
|
||||
# endif
|
||||
# ifndef int64_t
|
||||
typedef __int64 int64_t;
|
||||
# endif
|
||||
# ifndef uint64_t
|
||||
typedef unsigned __int64 uint64_t;
|
||||
# endif
|
||||
# ifndef PRId32
|
||||
# define PRId32 "I32d"
|
||||
# endif
|
||||
# ifndef PRIu32
|
||||
# define PRIu32 "I32u"
|
||||
# endif
|
||||
# ifndef PRId64
|
||||
# define PRId64 "I64d"
|
||||
# endif
|
||||
# ifndef PRIu64
|
||||
# define PRIu64 "I64u"
|
||||
# endif
|
||||
# ifndef INT32_MAX
|
||||
#define INT32_MAX _I32_MAX
|
||||
# endif
|
||||
# ifndef INT32_MIN
|
||||
#define INT32_MIN ((int32_t)_I32_MIN)
|
||||
# endif
|
||||
# ifndef UINT32_MAX
|
||||
#define UINT32_MAX _UI32_MAX
|
||||
# endif
|
||||
# ifndef INT64_MIN
|
||||
#define INT64_MIN ((int64_t)_I64_MIN)
|
||||
# endif
|
||||
# ifndef INT64_MAX
|
||||
#define INT64_MAX _I64_MAX
|
||||
# endif
|
||||
# ifndef UINT64_MAX
|
||||
#define UINT64_MAX _UI64_MAX
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif /* TIMELIB_OMIT_STDINT */
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#else
|
||||
#include <strings.h>
|
||||
#endif
|
||||
|
||||
#if (defined(__x86_64__) || defined(__LP64__) || defined(_LP64) || defined(_WIN64)) && !defined(TIMELIB_FORCE_LONG32)
|
||||
typedef int64_t timelib_long;
|
||||
typedef uint64_t timelib_ulong;
|
||||
# define TIMELIB_LONG_MAX INT64_MAX
|
||||
# define TIMELIB_LONG_MIN INT64_MIN
|
||||
# define TIMELIB_ULONG_MAX UINT64_MAX
|
||||
# define TIMELIB_LONG_FMT "%" PRId64
|
||||
# define TIMELIB_ULONG_FMT "%" PRIu64
|
||||
#else
|
||||
typedef int32_t timelib_long;
|
||||
typedef uint32_t timelib_ulong;
|
||||
# define TIMELIB_LONG_MAX INT32_MAX
|
||||
# define TIMELIB_LONG_MIN INT32_MIN
|
||||
# define TIMELIB_ULONG_MAX UINT32_MAX
|
||||
# define TIMELIB_LONG_FMT "%" PRId32
|
||||
# define TIMELIB_ULONG_FMT "%" PRIu32
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
typedef uint64_t timelib_ull;
|
||||
typedef int64_t timelib_sll;
|
||||
# define TIMELIB_LL_CONST(n) n ## i64
|
||||
#else
|
||||
typedef unsigned long long timelib_ull;
|
||||
typedef signed long long timelib_sll;
|
||||
# define TIMELIB_LL_CONST(n) n ## ll
|
||||
#endif
|
||||
|
||||
typedef struct ttinfo
|
||||
{
|
||||
int32_t offset;
|
||||
int isdst;
|
||||
unsigned int abbr_idx;
|
||||
|
||||
unsigned int isstdcnt;
|
||||
unsigned int isgmtcnt;
|
||||
} ttinfo;
|
||||
|
||||
typedef struct tlinfo
|
||||
{
|
||||
int32_t trans;
|
||||
int32_t offset;
|
||||
} tlinfo;
|
||||
|
||||
typedef struct tlocinfo
|
||||
{
|
||||
char country_code[3];
|
||||
double latitude;
|
||||
double longitude;
|
||||
char *comments;
|
||||
} tlocinfo;
|
||||
|
||||
typedef struct timelib_tzinfo
|
||||
{
|
||||
char *name;
|
||||
struct {
|
||||
uint32_t ttisgmtcnt;
|
||||
uint32_t ttisstdcnt;
|
||||
uint32_t leapcnt;
|
||||
uint32_t timecnt;
|
||||
uint32_t typecnt;
|
||||
uint32_t charcnt;
|
||||
} bit32;
|
||||
struct {
|
||||
uint64_t ttisgmtcnt;
|
||||
uint64_t ttisstdcnt;
|
||||
uint64_t leapcnt;
|
||||
uint64_t timecnt;
|
||||
uint64_t typecnt;
|
||||
uint64_t charcnt;
|
||||
} bit64;
|
||||
|
||||
int32_t *trans;
|
||||
unsigned char *trans_idx;
|
||||
|
||||
ttinfo *type;
|
||||
char *timezone_abbr;
|
||||
|
||||
tlinfo *leap_times;
|
||||
unsigned char bc;
|
||||
tlocinfo location;
|
||||
} timelib_tzinfo;
|
||||
|
||||
typedef struct timelib_special {
|
||||
unsigned int type;
|
||||
timelib_sll amount;
|
||||
} timelib_special;
|
||||
|
||||
typedef struct timelib_rel_time {
|
||||
timelib_sll y, m, d; /* Years, Months and Days */
|
||||
timelib_sll h, i, s; /* Hours, mInutes and Seconds */
|
||||
double f; /* Fraction */
|
||||
|
||||
int weekday; /* Stores the day in 'next monday' */
|
||||
int weekday_behavior; /* 0: the current day should *not* be counted when advancing forwards; 1: the current day *should* be counted */
|
||||
|
||||
int first_last_day_of;
|
||||
int invert; /* Whether the difference should be inverted */
|
||||
timelib_sll days; /* Contains the number of *days*, instead of Y-M-D differences */
|
||||
|
||||
timelib_special special;
|
||||
unsigned int have_weekday_relative, have_special_relative;
|
||||
} timelib_rel_time;
|
||||
|
||||
typedef struct timelib_time_offset {
|
||||
int32_t offset;
|
||||
unsigned int leap_secs;
|
||||
unsigned int is_dst;
|
||||
char *abbr;
|
||||
timelib_sll transistion_time;
|
||||
} timelib_time_offset;
|
||||
|
||||
typedef struct timelib_time {
|
||||
timelib_sll y, m, d; /* Year, Month, Day */
|
||||
timelib_sll h, i, s; /* Hour, mInute, Second */
|
||||
double f; /* Fraction */
|
||||
int z; /* GMT offset in minutes */
|
||||
char *tz_abbr; /* Timezone abbreviation (display only) */
|
||||
timelib_tzinfo *tz_info; /* Timezone structure */
|
||||
signed int dst; /* Flag if we were parsing a DST zone */
|
||||
timelib_rel_time relative;
|
||||
|
||||
timelib_sll sse; /* Seconds since epoch */
|
||||
|
||||
unsigned int have_time, have_date, have_zone, have_relative, have_weeknr_day;
|
||||
|
||||
unsigned int sse_uptodate; /* !0 if the sse member is up to date with the date/time members */
|
||||
unsigned int tim_uptodate; /* !0 if the date/time members are up to date with the sse member */
|
||||
unsigned int is_localtime; /* 1 if the current struct represents localtime, 0 if it is in GMT */
|
||||
unsigned int zone_type; /* 1 time offset,
|
||||
* 3 TimeZone identifier,
|
||||
* 2 TimeZone abbreviation */
|
||||
} timelib_time;
|
||||
|
||||
typedef struct timelib_abbr_info {
|
||||
timelib_sll utc_offset;
|
||||
char *abbr;
|
||||
int dst;
|
||||
} timelib_abbr_info;
|
||||
|
||||
typedef struct timelib_error_message {
|
||||
int position;
|
||||
char character;
|
||||
char *message;
|
||||
} timelib_error_message;
|
||||
|
||||
typedef struct timelib_error_container {
|
||||
struct timelib_error_message *error_messages;
|
||||
struct timelib_error_message *warning_messages;
|
||||
int error_count;
|
||||
int warning_count;
|
||||
} timelib_error_container;
|
||||
|
||||
typedef struct _timelib_tz_lookup_table {
|
||||
char *name;
|
||||
int type;
|
||||
float gmtoffset;
|
||||
char *full_tz_name;
|
||||
} timelib_tz_lookup_table;
|
||||
|
||||
typedef struct _timelib_tzdb_index_entry {
|
||||
char *id;
|
||||
unsigned int pos;
|
||||
} timelib_tzdb_index_entry;
|
||||
|
||||
typedef struct _timelib_tzdb {
|
||||
char *version;
|
||||
int index_size;
|
||||
const timelib_tzdb_index_entry *index;
|
||||
const unsigned char *data;
|
||||
} timelib_tzdb;
|
||||
|
||||
#define TIMELIB_ZONETYPE_OFFSET 1
|
||||
#define TIMELIB_ZONETYPE_ABBR 2
|
||||
#define TIMELIB_ZONETYPE_ID 3
|
||||
|
||||
#define SECS_PER_ERA TIMELIB_LL_CONST(12622780800)
|
||||
#define SECS_PER_DAY 86400
|
||||
#define DAYS_PER_YEAR 365
|
||||
#define DAYS_PER_LYEAR 366
|
||||
/* 400*365 days + 97 leap days */
|
||||
#define DAYS_PER_LYEAR_PERIOD 146097
|
||||
#define YEARS_PER_LYEAR_PERIOD 400
|
||||
|
||||
#define timelib_is_leap(y) ((y) % 4 == 0 && ((y) % 100 != 0 || (y) % 400 == 0))
|
||||
|
||||
#define TIMELIB_DEBUG(s) if (0) { s }
|
||||
|
||||
#endif
|
||||
+1009
-1078
File diff suppressed because it is too large.
Load diff
+14
-489
@@ -4,29 +4,18 @@
|
||||
{ "acdt", 1, 37800, "Australia/North" },
|
||||
{ "acdt", 1, 37800, "Australia/South" },
|
||||
{ "acdt", 1, 37800, "Australia/Yancowinna" },
|
||||
{ "acst", 1, -14400, "America/Porto_Acre" },
|
||||
{ "acst", 0, 32400, "Australia/Adelaide" },
|
||||
{ "acst", 0, 34200, "Australia/Adelaide" },
|
||||
{ "acst", 1, -14400, "America/Eirunepe" },
|
||||
{ "acst", 1, -14400, "America/Rio_Branco" },
|
||||
{ "acst", 1, -14400, "Brazil/Acre" },
|
||||
{ "acst", 0, 32400, "Australia/Broken_Hill" },
|
||||
{ "acst", 0, 32400, "Australia/Darwin" },
|
||||
{ "acst", 0, 32400, "Australia/North" },
|
||||
{ "acst", 0, 32400, "Australia/South" },
|
||||
{ "acst", 0, 32400, "Australia/Yancowinna" },
|
||||
{ "acst", 0, 34200, "Asia/Jayapura" },
|
||||
{ "acst", 0, 34200, "Australia/Broken_Hill" },
|
||||
{ "acst", 0, 34200, "Australia/Darwin" },
|
||||
{ "acst", 0, 34200, "Australia/North" },
|
||||
{ "acst", 0, 34200, "Australia/South" },
|
||||
{ "acst", 0, 34200, "Australia/Yancowinna" },
|
||||
{ "act", 0, -18000, "America/Porto_Acre" },
|
||||
{ "act", 0, -18000, "America/Eirunepe" },
|
||||
{ "act", 0, -18000, "America/Rio_Branco" },
|
||||
{ "act", 0, -18000, "Brazil/Acre" },
|
||||
{ "acwdt", 1, 35100, "Australia/Eucla" },
|
||||
{ "acwst", 0, 31500, "Australia/Eucla" },
|
||||
{ "addt", 1, -7200, "America/Goose_Bay" },
|
||||
{ "addt", 1, -7200, "America/Pangnirtung" },
|
||||
{ "adt", 1, -10800, "America/Halifax" },
|
||||
@@ -40,7 +29,6 @@
|
||||
{ "adt", 1, -10800, "America/Thule" },
|
||||
{ "adt", 1, -10800, "Atlantic/Bermuda" },
|
||||
{ "adt", 1, -10800, "Canada/Atlantic" },
|
||||
{ "adt", 1, 14400, "Asia/Baghdad" },
|
||||
{ "aedt", 1, 39600, "Australia/Melbourne" },
|
||||
{ "aedt", 1, 39600, "Antarctica/Macquarie" },
|
||||
{ "aedt", 1, 39600, "Australia/ACT" },
|
||||
@@ -69,8 +57,6 @@
|
||||
{ "aest", 0, 36000, "Australia/Sydney" },
|
||||
{ "aest", 0, 36000, "Australia/Tasmania" },
|
||||
{ "aest", 0, 36000, "Australia/Victoria" },
|
||||
{ "aft", 0, 16200, "Asia/Kabul" },
|
||||
{ "aft", 0, 14400, "Asia/Kabul" },
|
||||
{ "ahdt", 1, -32400, "America/Anchorage" },
|
||||
{ "ahst", 0, -36000, "America/Anchorage" },
|
||||
{ "ahst", 0, -36000, "America/Adak" },
|
||||
@@ -87,31 +73,9 @@
|
||||
{ "akst", 0, -32400, "America/Nome" },
|
||||
{ "akst", 0, -32400, "America/Sitka" },
|
||||
{ "akst", 0, -32400, "America/Yakutat" },
|
||||
{ "amst", 1, -10800, "America/Boa_Vista" },
|
||||
{ "amst", 1, -10800, "America/Campo_Grande" },
|
||||
{ "amst", 1, -10800, "America/Cuiaba" },
|
||||
{ "amst", 1, -10800, "America/Manaus" },
|
||||
{ "amst", 1, -10800, "America/Porto_Velho" },
|
||||
{ "amst", 1, -10800, "America/Santarem" },
|
||||
{ "amst", 1, -10800, "Brazil/West" },
|
||||
{ "amt", 0, -13840, "America/Asuncion" },
|
||||
{ "amt", 0, -14400, "America/Boa_Vista" },
|
||||
{ "amt", 0, -14400, "America/Campo_Grande" },
|
||||
{ "amt", 0, -14400, "America/Cuiaba" },
|
||||
{ "amt", 0, -14400, "America/Eirunepe" },
|
||||
{ "amt", 0, -14400, "America/Manaus" },
|
||||
{ "amt", 0, -14400, "America/Porto_Acre" },
|
||||
{ "amt", 0, -14400, "America/Porto_Velho" },
|
||||
{ "amt", 0, -14400, "America/Rio_Branco" },
|
||||
{ "amt", 0, -14400, "America/Santarem" },
|
||||
{ "amt", 0, -14400, "Brazil/Acre" },
|
||||
{ "amt", 0, -14400, "Brazil/West" },
|
||||
{ "amt", 0, 1172, "Europe/Amsterdam" },
|
||||
{ "amt", 0, 5692, "Europe/Athens" },
|
||||
{ "ant", 0, -16200, "America/Curacao" },
|
||||
{ "ant", 0, -16200, "America/Aruba" },
|
||||
{ "ant", 0, -16200, "America/Kralendijk" },
|
||||
{ "ant", 0, -16200, "America/Lower_Princes" },
|
||||
{ "apt", 1, -10800, "America/Halifax" },
|
||||
{ "apt", 1, -10800, "America/Blanc-Sablon" },
|
||||
{ "apt", 1, -10800, "America/Glace_Bay" },
|
||||
@@ -119,87 +83,7 @@
|
||||
{ "apt", 1, -10800, "America/Pangnirtung" },
|
||||
{ "apt", 1, -10800, "America/Puerto_Rico" },
|
||||
{ "apt", 1, -10800, "Canada/Atlantic" },
|
||||
{ "arst", 1, -7200, "America/Buenos_Aires" },
|
||||
{ "arst", 1, -10800, "America/Buenos_Aires" },
|
||||
{ "arst", 1, -10800, "America/Argentina/Buenos_Aires" },
|
||||
{ "arst", 1, -10800, "America/Argentina/Catamarca" },
|
||||
{ "arst", 1, -10800, "America/Argentina/ComodRivadavia" },
|
||||
{ "arst", 1, -10800, "America/Argentina/Cordoba" },
|
||||
{ "arst", 1, -10800, "America/Argentina/Jujuy" },
|
||||
{ "arst", 1, -10800, "America/Argentina/La_Rioja" },
|
||||
{ "arst", 1, -10800, "America/Argentina/Mendoza" },
|
||||
{ "arst", 1, -10800, "America/Argentina/Rio_Gallegos" },
|
||||
{ "arst", 1, -10800, "America/Argentina/Salta" },
|
||||
{ "arst", 1, -10800, "America/Argentina/San_Juan" },
|
||||
{ "arst", 1, -10800, "America/Argentina/San_Luis" },
|
||||
{ "arst", 1, -10800, "America/Argentina/Tucuman" },
|
||||
{ "arst", 1, -10800, "America/Argentina/Ushuaia" },
|
||||
{ "arst", 1, -10800, "America/Catamarca" },
|
||||
{ "arst", 1, -10800, "America/Cordoba" },
|
||||
{ "arst", 1, -10800, "America/Jujuy" },
|
||||
{ "arst", 1, -10800, "America/Mendoza" },
|
||||
{ "arst", 1, -10800, "America/Rosario" },
|
||||
{ "arst", 1, -10800, "Antarctica/Palmer" },
|
||||
{ "arst", 1, -7200, "America/Argentina/Buenos_Aires" },
|
||||
{ "arst", 1, -7200, "America/Argentina/Catamarca" },
|
||||
{ "arst", 1, -7200, "America/Argentina/ComodRivadavia" },
|
||||
{ "arst", 1, -7200, "America/Argentina/Cordoba" },
|
||||
{ "arst", 1, -7200, "America/Argentina/Jujuy" },
|
||||
{ "arst", 1, -7200, "America/Argentina/La_Rioja" },
|
||||
{ "arst", 1, -7200, "America/Argentina/Mendoza" },
|
||||
{ "arst", 1, -7200, "America/Argentina/Rio_Gallegos" },
|
||||
{ "arst", 1, -7200, "America/Argentina/Salta" },
|
||||
{ "arst", 1, -7200, "America/Argentina/San_Juan" },
|
||||
{ "arst", 1, -7200, "America/Argentina/San_Luis" },
|
||||
{ "arst", 1, -7200, "America/Argentina/Tucuman" },
|
||||
{ "arst", 1, -7200, "America/Argentina/Ushuaia" },
|
||||
{ "arst", 1, -7200, "America/Catamarca" },
|
||||
{ "arst", 1, -7200, "America/Cordoba" },
|
||||
{ "arst", 1, -7200, "America/Jujuy" },
|
||||
{ "arst", 1, -7200, "America/Mendoza" },
|
||||
{ "arst", 1, -7200, "America/Rosario" },
|
||||
{ "arst", 1, -7200, "Antarctica/Palmer" },
|
||||
{ "art", 0, -10800, "America/Buenos_Aires" },
|
||||
{ "art", 0, -14400, "America/Buenos_Aires" },
|
||||
{ "art", 0, -10800, "America/Argentina/Buenos_Aires" },
|
||||
{ "art", 0, -10800, "America/Argentina/Catamarca" },
|
||||
{ "art", 0, -10800, "America/Argentina/ComodRivadavia" },
|
||||
{ "art", 0, -10800, "America/Argentina/Cordoba" },
|
||||
{ "art", 0, -10800, "America/Argentina/Jujuy" },
|
||||
{ "art", 0, -10800, "America/Argentina/La_Rioja" },
|
||||
{ "art", 0, -10800, "America/Argentina/Mendoza" },
|
||||
{ "art", 0, -10800, "America/Argentina/Rio_Gallegos" },
|
||||
{ "art", 0, -10800, "America/Argentina/Salta" },
|
||||
{ "art", 0, -10800, "America/Argentina/San_Juan" },
|
||||
{ "art", 0, -10800, "America/Argentina/San_Luis" },
|
||||
{ "art", 0, -10800, "America/Argentina/Tucuman" },
|
||||
{ "art", 0, -10800, "America/Argentina/Ushuaia" },
|
||||
{ "art", 0, -10800, "America/Catamarca" },
|
||||
{ "art", 0, -10800, "America/Cordoba" },
|
||||
{ "art", 0, -10800, "America/Jujuy" },
|
||||
{ "art", 0, -10800, "America/Mendoza" },
|
||||
{ "art", 0, -10800, "America/Rosario" },
|
||||
{ "art", 0, -10800, "Antarctica/Palmer" },
|
||||
{ "art", 0, -14400, "America/Argentina/Buenos_Aires" },
|
||||
{ "art", 0, -14400, "America/Argentina/Catamarca" },
|
||||
{ "art", 0, -14400, "America/Argentina/ComodRivadavia" },
|
||||
{ "art", 0, -14400, "America/Argentina/Cordoba" },
|
||||
{ "art", 0, -14400, "America/Argentina/Jujuy" },
|
||||
{ "art", 0, -14400, "America/Argentina/La_Rioja" },
|
||||
{ "art", 0, -14400, "America/Argentina/Mendoza" },
|
||||
{ "art", 0, -14400, "America/Argentina/Rio_Gallegos" },
|
||||
{ "art", 0, -14400, "America/Argentina/Salta" },
|
||||
{ "art", 0, -14400, "America/Argentina/San_Juan" },
|
||||
{ "art", 0, -14400, "America/Argentina/San_Luis" },
|
||||
{ "art", 0, -14400, "America/Argentina/Tucuman" },
|
||||
{ "art", 0, -14400, "America/Argentina/Ushuaia" },
|
||||
{ "art", 0, -14400, "America/Catamarca" },
|
||||
{ "art", 0, -14400, "America/Cordoba" },
|
||||
{ "art", 0, -14400, "America/Jujuy" },
|
||||
{ "art", 0, -14400, "America/Mendoza" },
|
||||
{ "art", 0, -14400, "America/Rosario" },
|
||||
{ "art", 0, -14400, "Antarctica/Palmer" },
|
||||
{ "ast", 0, 10800, "Asia/Riyadh" },
|
||||
{ "apt", 1, -32400, "America/Anchorage" },
|
||||
{ "ast", 0, -14400, "America/Anguilla" },
|
||||
{ "ast", 0, -14400, "America/Antigua" },
|
||||
{ "ast", 0, -14400, "America/Aruba" },
|
||||
@@ -234,11 +118,7 @@
|
||||
{ "ast", 0, -14400, "America/Virgin" },
|
||||
{ "ast", 0, -14400, "Atlantic/Bermuda" },
|
||||
{ "ast", 0, -14400, "Canada/Atlantic" },
|
||||
{ "ast", 0, 10800, "Asia/Aden" },
|
||||
{ "ast", 0, 10800, "Asia/Baghdad" },
|
||||
{ "ast", 0, 10800, "Asia/Bahrain" },
|
||||
{ "ast", 0, 10800, "Asia/Kuwait" },
|
||||
{ "ast", 0, 10800, "Asia/Qatar" },
|
||||
{ "ast", 0, -36000, "America/Anchorage" },
|
||||
{ "awdt", 1, 32400, "Australia/Perth" },
|
||||
{ "awdt", 1, 32400, "Australia/West" },
|
||||
{ "awst", 0, 28800, "Australia/Perth" },
|
||||
@@ -250,14 +130,8 @@
|
||||
{ "awt", 1, -10800, "America/Pangnirtung" },
|
||||
{ "awt", 1, -10800, "America/Puerto_Rico" },
|
||||
{ "awt", 1, -10800, "Canada/Atlantic" },
|
||||
{ "azomt", 1, 0, "Atlantic/Azores" },
|
||||
{ "azost", 1, 0, "Atlantic/Azores" },
|
||||
{ "azost", 1, -3600, "Atlantic/Azores" },
|
||||
{ "azot", 0, -3600, "Atlantic/Azores" },
|
||||
{ "azot", 0, -7200, "Atlantic/Azores" },
|
||||
{ "awt", 1, -32400, "America/Anchorage" },
|
||||
{ "bdst", 1, 7200, "Europe/London" },
|
||||
{ "bdst", 1, 25200, "Asia/Dacca" },
|
||||
{ "bdst", 1, 25200, "Asia/Dhaka" },
|
||||
{ "bdst", 1, 7200, "Europe/Belfast" },
|
||||
{ "bdst", 1, 7200, "Europe/Gibraltar" },
|
||||
{ "bdst", 1, 7200, "Europe/Guernsey" },
|
||||
@@ -265,32 +139,8 @@
|
||||
{ "bdst", 1, 7200, "Europe/Jersey" },
|
||||
{ "bdst", 1, 7200, "GB" },
|
||||
{ "bdt", 1, -36000, "America/Adak" },
|
||||
{ "bdt", 0, 21600, "Asia/Dacca" },
|
||||
{ "bdt", 1, -36000, "America/Atka" },
|
||||
{ "bdt", 1, -36000, "America/Nome" },
|
||||
{ "bdt", 0, 21600, "Asia/Dhaka" },
|
||||
{ "beat", 0, 9000, "Africa/Mogadishu" },
|
||||
{ "beat", 0, 9000, "Africa/Addis_Ababa" },
|
||||
{ "beat", 0, 9000, "Africa/Asmara" },
|
||||
{ "beat", 0, 9000, "Africa/Asmera" },
|
||||
{ "beat", 0, 9000, "Africa/Dar_es_Salaam" },
|
||||
{ "beat", 0, 9000, "Africa/Djibouti" },
|
||||
{ "beat", 0, 9000, "Africa/Kampala" },
|
||||
{ "beat", 0, 9000, "Africa/Nairobi" },
|
||||
{ "beat", 0, 9000, "Indian/Antananarivo" },
|
||||
{ "beat", 0, 9000, "Indian/Comoro" },
|
||||
{ "beat", 0, 9000, "Indian/Mayotte" },
|
||||
{ "beaut", 0, 9900, "Africa/Nairobi" },
|
||||
{ "beaut", 0, 9900, "Africa/Addis_Ababa" },
|
||||
{ "beaut", 0, 9900, "Africa/Asmara" },
|
||||
{ "beaut", 0, 9900, "Africa/Asmera" },
|
||||
{ "beaut", 0, 9900, "Africa/Dar_es_Salaam" },
|
||||
{ "beaut", 0, 9900, "Africa/Djibouti" },
|
||||
{ "beaut", 0, 9900, "Africa/Kampala" },
|
||||
{ "beaut", 0, 9900, "Africa/Mogadishu" },
|
||||
{ "beaut", 0, 9900, "Indian/Antananarivo" },
|
||||
{ "beaut", 0, 9900, "Indian/Comoro" },
|
||||
{ "beaut", 0, 9900, "Indian/Mayotte" },
|
||||
{ "bmt", 0, -14309, "America/Barbados" },
|
||||
{ "bmt", 0, 6264, "Europe/Tiraspol" },
|
||||
{ "bmt", 0, -17776, "America/Bogota" },
|
||||
@@ -305,38 +155,12 @@
|
||||
{ "bmt", 0, 25632, "Asia/Jakarta" },
|
||||
{ "bmt", 0, 6264, "Europe/Bucharest" },
|
||||
{ "bmt", 0, 6264, "Europe/Chisinau" },
|
||||
{ "bnt", 0, 28800, "Asia/Brunei" },
|
||||
{ "bnt", 0, 27000, "Asia/Brunei" },
|
||||
{ "bortst", 1, 30000, "Asia/Kuching" },
|
||||
{ "bort", 0, 28800, "Asia/Kuching" },
|
||||
{ "bort", 0, 27000, "Asia/Kuching" },
|
||||
{ "bost", 1, -12756, "America/La_Paz" },
|
||||
{ "bot", 0, -14400, "America/La_Paz" },
|
||||
{ "brst", 1, -7200, "America/Sao_Paulo" },
|
||||
{ "brst", 1, -7200, "America/Araguaina" },
|
||||
{ "brst", 1, -7200, "America/Bahia" },
|
||||
{ "brst", 1, -7200, "America/Belem" },
|
||||
{ "brst", 1, -7200, "America/Fortaleza" },
|
||||
{ "brst", 1, -7200, "America/Maceio" },
|
||||
{ "brst", 1, -7200, "America/Recife" },
|
||||
{ "brst", 1, -7200, "Brazil/East" },
|
||||
{ "brt", 0, -10800, "America/Sao_Paulo" },
|
||||
{ "brt", 0, -10800, "America/Araguaina" },
|
||||
{ "brt", 0, -10800, "America/Bahia" },
|
||||
{ "brt", 0, -10800, "America/Belem" },
|
||||
{ "brt", 0, -10800, "America/Fortaleza" },
|
||||
{ "brt", 0, -10800, "America/Maceio" },
|
||||
{ "brt", 0, -10800, "America/Recife" },
|
||||
{ "brt", 0, -10800, "America/Santarem" },
|
||||
{ "brt", 0, -10800, "Brazil/East" },
|
||||
{ "bst", 1, 3600, "Europe/London" },
|
||||
{ "bst", 0, 3600, "Europe/London" },
|
||||
{ "bst", 0, -39600, "America/Adak" },
|
||||
{ "bst", 0, -39600, "America/Atka" },
|
||||
{ "bst", 0, -39600, "America/Nome" },
|
||||
{ "bst", 0, -39600, "Pacific/Midway" },
|
||||
{ "bst", 0, -39600, "Pacific/Pago_Pago" },
|
||||
{ "bst", 0, -39600, "Pacific/Samoa" },
|
||||
{ "bst", 0, 3600, "Europe/Belfast" },
|
||||
{ "bst", 0, 3600, "Europe/Guernsey" },
|
||||
{ "bst", 0, 3600, "Europe/Isle_of_Man" },
|
||||
@@ -349,21 +173,9 @@
|
||||
{ "bst", 1, 3600, "Europe/Isle_of_Man" },
|
||||
{ "bst", 1, 3600, "Europe/Jersey" },
|
||||
{ "bst", 1, 3600, "GB" },
|
||||
{ "bst", 0, 39600, "Pacific/Bougainville" },
|
||||
{ "btt", 0, 21600, "Asia/Thimbu" },
|
||||
{ "btt", 0, 21600, "Asia/Thimphu" },
|
||||
{ "burt", 0, 23400, "Asia/Kolkata" },
|
||||
{ "burt", 0, 23400, "Asia/Calcutta" },
|
||||
{ "burt", 0, 23400, "Asia/Dacca" },
|
||||
{ "burt", 0, 23400, "Asia/Dhaka" },
|
||||
{ "burt", 0, 23400, "Asia/Rangoon" },
|
||||
{ "burt", 0, 23400, "Asia/Yangon" },
|
||||
{ "cant", 0, -3600, "Atlantic/Canary" },
|
||||
{ "capt", 1, -32400, "America/Anchorage" },
|
||||
{ "cast", 0, 34200, "Australia/Adelaide" },
|
||||
{ "cast", 1, 10800, "Africa/Juba" },
|
||||
{ "cast", 1, 10800, "Africa/Khartoum" },
|
||||
{ "cat", 0, -36000, "America/Anchorage" },
|
||||
{ "cat", 0, 7200, "Africa/Khartoum" },
|
||||
{ "cat", 0, 7200, "Africa/Blantyre" },
|
||||
{ "cat", 0, 7200, "Africa/Bujumbura" },
|
||||
@@ -375,8 +187,6 @@
|
||||
{ "cat", 0, 7200, "Africa/Lusaka" },
|
||||
{ "cat", 0, 7200, "Africa/Maputo" },
|
||||
{ "cat", 0, 7200, "Africa/Windhoek" },
|
||||
{ "cawt", 1, -32400, "America/Anchorage" },
|
||||
{ "cct", 0, 23400, "Indian/Cocos" },
|
||||
{ "cddt", 1, -14400, "America/Rankin_Inlet" },
|
||||
{ "cddt", 1, -14400, "America/Resolute" },
|
||||
{ "cdt", 1, -18000, "America/Chicago" },
|
||||
@@ -428,6 +238,8 @@
|
||||
{ "cdt", 1, 32400, "Asia/Chongqing" },
|
||||
{ "cdt", 1, 32400, "Asia/Chungking" },
|
||||
{ "cdt", 1, 32400, "Asia/Harbin" },
|
||||
{ "cdt", 1, 32400, "Asia/Macao" },
|
||||
{ "cdt", 1, 32400, "Asia/Macau" },
|
||||
{ "cdt", 1, 32400, "Asia/Taipei" },
|
||||
{ "cdt", 1, 32400, "PRC" },
|
||||
{ "cdt", 1, 32400, "ROC" },
|
||||
@@ -537,32 +349,6 @@
|
||||
{ "cet", 0, 3600, "Europe/Zagreb" },
|
||||
{ "cet", 0, 3600, "Europe/Zaporozhye" },
|
||||
{ "cet", 0, 3600, "Europe/Zurich" },
|
||||
{ "cgst", 1, -3600, "America/Scoresbysund" },
|
||||
{ "cgt", 0, -7200, "America/Scoresbysund" },
|
||||
{ "chadt", 1, 49500, "Pacific/Chatham" },
|
||||
{ "chast", 0, 45900, "Pacific/Chatham" },
|
||||
{ "chast", 0, 44100, "Pacific/Chatham" },
|
||||
{ "chdt", 1, -19800, "America/Belize" },
|
||||
{ "chost", 1, 36000, "Asia/Choibalsan" },
|
||||
{ "chost", 1, 32400, "Asia/Choibalsan" },
|
||||
{ "chot", 0, 32400, "Asia/Choibalsan" },
|
||||
{ "chot", 0, 28800, "Asia/Choibalsan" },
|
||||
{ "chut", 0, 36000, "Pacific/Chuuk" },
|
||||
{ "chut", 0, 36000, "Pacific/Truk" },
|
||||
{ "chut", 0, 36000, "Pacific/Yap" },
|
||||
{ "ckhst", 1, -34200, "Pacific/Rarotonga" },
|
||||
{ "ckt", 0, -36000, "Pacific/Rarotonga" },
|
||||
{ "ckt", 0, -37800, "Pacific/Rarotonga" },
|
||||
{ "clst", 1, -10800, "America/Santiago" },
|
||||
{ "clst", 1, -14400, "America/Santiago" },
|
||||
{ "clst", 1, -10800, "Antarctica/Palmer" },
|
||||
{ "clst", 1, -10800, "Chile/Continental" },
|
||||
{ "clst", 1, -14400, "Chile/Continental" },
|
||||
{ "clt", 0, -14400, "America/Santiago" },
|
||||
{ "clt", 0, -18000, "America/Santiago" },
|
||||
{ "clt", 0, -14400, "Antarctica/Palmer" },
|
||||
{ "clt", 0, -14400, "Chile/Continental" },
|
||||
{ "clt", 0, -18000, "Chile/Continental" },
|
||||
{ "cmt", 0, -15408, "America/Argentina/Buenos_Aires" },
|
||||
{ "cmt", 0, -15408, "America/Argentina/Catamarca" },
|
||||
{ "cmt", 0, -15408, "America/Argentina/ComodRivadavia" },
|
||||
@@ -589,8 +375,6 @@
|
||||
{ "cmt", 0, 3020, "Europe/Copenhagen" },
|
||||
{ "cmt", 0, 6900, "Europe/Chisinau" },
|
||||
{ "cmt", 0, 6900, "Europe/Tiraspol" },
|
||||
{ "cost", 1, -14400, "America/Bogota" },
|
||||
{ "cot", 0, -18000, "America/Bogota" },
|
||||
{ "cpt", 1, -18000, "America/Chicago" },
|
||||
{ "cpt", 1, -18000, "America/Atikokan" },
|
||||
{ "cpt", 1, -18000, "America/Coral_Harbour" },
|
||||
@@ -662,7 +446,6 @@
|
||||
{ "cst", 0, -21600, "America/Thunder_Bay" },
|
||||
{ "cst", 0, -21600, "America/Winnipeg" },
|
||||
{ "cst", 0, -21600, "Canada/Central" },
|
||||
{ "cst", 0, -21600, "Canada/East-Saskatchewan" },
|
||||
{ "cst", 0, -21600, "Canada/Saskatchewan" },
|
||||
{ "cst", 0, -21600, "Mexico/BajaSur" },
|
||||
{ "cst", 0, -21600, "Mexico/General" },
|
||||
@@ -675,10 +458,6 @@
|
||||
{ "cst", 0, 28800, "Asia/Taipei" },
|
||||
{ "cst", 0, 28800, "PRC" },
|
||||
{ "cst", 0, 28800, "ROC" },
|
||||
{ "cut", 0, 8400, "Europe/Zaporozhye" },
|
||||
{ "cvst", 1, -3600, "Atlantic/Cape_Verde" },
|
||||
{ "cvt", 0, -7200, "Atlantic/Cape_Verde" },
|
||||
{ "cvt", 0, -3600, "Atlantic/Cape_Verde" },
|
||||
{ "cwt", 1, -18000, "America/Chicago" },
|
||||
{ "cwt", 1, -18000, "America/Atikokan" },
|
||||
{ "cwt", 1, -18000, "America/Coral_Harbour" },
|
||||
@@ -702,20 +481,9 @@
|
||||
{ "cwt", 1, -18000, "America/Winnipeg" },
|
||||
{ "cwt", 1, -18000, "Canada/Central" },
|
||||
{ "cwt", 1, -18000, "Mexico/General" },
|
||||
{ "cxt", 0, 25200, "Indian/Christmas" },
|
||||
{ "chst", 0, 36000, "Pacific/Guam" },
|
||||
{ "chst", 0, 36000, "Pacific/Saipan" },
|
||||
{ "dact", 0, 21600, "Asia/Dacca" },
|
||||
{ "dact", 0, 21600, "Asia/Dhaka" },
|
||||
{ "dmt", 0, -1521, "Europe/Dublin" },
|
||||
{ "easst", 1, -21600, "Chile/EasterIsland" },
|
||||
{ "easst", 1, -18000, "Chile/EasterIsland" },
|
||||
{ "easst", 1, -18000, "Pacific/Easter" },
|
||||
{ "easst", 1, -21600, "Pacific/Easter" },
|
||||
{ "east", 0, -21600, "Chile/EasterIsland" },
|
||||
{ "east", 0, -25200, "Chile/EasterIsland" },
|
||||
{ "east", 0, -21600, "Pacific/Easter" },
|
||||
{ "east", 0, -25200, "Pacific/Easter" },
|
||||
{ "eat", 0, 10800, "Africa/Khartoum" },
|
||||
{ "eat", 0, 10800, "Africa/Addis_Ababa" },
|
||||
{ "eat", 0, 10800, "Africa/Asmara" },
|
||||
@@ -729,8 +497,6 @@
|
||||
{ "eat", 0, 10800, "Indian/Antananarivo" },
|
||||
{ "eat", 0, 10800, "Indian/Comoro" },
|
||||
{ "eat", 0, 10800, "Indian/Mayotte" },
|
||||
{ "ect", 0, -18000, "America/Guayaquil" },
|
||||
{ "ect", 0, -18000, "Pacific/Galapagos" },
|
||||
{ "eddt", 1, -10800, "America/Iqaluit" },
|
||||
{ "edt", 1, -14400, "America/New_York" },
|
||||
{ "edt", 1, -14400, "America/Cancun" },
|
||||
@@ -764,6 +530,7 @@
|
||||
{ "eest", 1, 10800, "Asia/Amman" },
|
||||
{ "eest", 1, 10800, "Asia/Beirut" },
|
||||
{ "eest", 1, 10800, "Asia/Damascus" },
|
||||
{ "eest", 1, 10800, "Asia/Famagusta" },
|
||||
{ "eest", 1, 10800, "Asia/Gaza" },
|
||||
{ "eest", 1, 10800, "Asia/Hebron" },
|
||||
{ "eest", 1, 10800, "Asia/Istanbul" },
|
||||
@@ -788,13 +555,12 @@
|
||||
{ "eest", 1, 10800, "Europe/Warsaw" },
|
||||
{ "eest", 1, 10800, "Europe/Zaporozhye" },
|
||||
{ "eet", 0, 7200, "Europe/Helsinki" },
|
||||
{ "eet", 1, 10800, "Asia/Gaza" },
|
||||
{ "eet", 1, 10800, "Asia/Hebron" },
|
||||
{ "eet", 0, 7200, "Africa/Cairo" },
|
||||
{ "eet", 0, 7200, "Africa/Tripoli" },
|
||||
{ "eet", 0, 7200, "Asia/Amman" },
|
||||
{ "eet", 0, 7200, "Asia/Beirut" },
|
||||
{ "eet", 0, 7200, "Asia/Damascus" },
|
||||
{ "eet", 0, 7200, "Asia/Famagusta" },
|
||||
{ "eet", 0, 7200, "Asia/Gaza" },
|
||||
{ "eet", 0, 7200, "Asia/Hebron" },
|
||||
{ "eet", 0, 7200, "Asia/Istanbul" },
|
||||
@@ -818,9 +584,6 @@
|
||||
{ "eet", 0, 7200, "Europe/Vilnius" },
|
||||
{ "eet", 0, 7200, "Europe/Warsaw" },
|
||||
{ "eet", 0, 7200, "Europe/Zaporozhye" },
|
||||
{ "egst", 1, 0, "America/Scoresbysund" },
|
||||
{ "egt", 0, -3600, "America/Scoresbysund" },
|
||||
{ "ehdt", 1, -16200, "America/Santo_Domingo" },
|
||||
{ "emt", 0, -26248, "Chile/EasterIsland" },
|
||||
{ "emt", 0, -26248, "Pacific/Easter" },
|
||||
{ "ept", 1, -14400, "America/New_York" },
|
||||
@@ -881,25 +644,7 @@
|
||||
{ "ewt", 1, -14400, "America/Toronto" },
|
||||
{ "ewt", 1, -14400, "Canada/Eastern" },
|
||||
{ "ffmt", 0, -14660, "America/Martinique" },
|
||||
{ "fjst", 1, 46800, "Pacific/Fiji" },
|
||||
{ "fjt", 0, 43200, "Pacific/Fiji" },
|
||||
{ "fkst", 1, -7200, "Atlantic/Stanley" },
|
||||
{ "fkst", 0, -10800, "Atlantic/Stanley" },
|
||||
{ "fkst", 1, -10800, "Atlantic/Stanley" },
|
||||
{ "fkt", 0, -14400, "Atlantic/Stanley" },
|
||||
{ "fkt", 0, -10800, "Atlantic/Stanley" },
|
||||
{ "fmt", 0, -4056, "Atlantic/Madeira" },
|
||||
{ "fnst", 1, -3600, "America/Noronha" },
|
||||
{ "fnst", 1, -3600, "Brazil/DeNoronha" },
|
||||
{ "fnt", 0, -7200, "America/Noronha" },
|
||||
{ "fnt", 0, -7200, "Brazil/DeNoronha" },
|
||||
{ "galt", 0, -21600, "Pacific/Galapagos" },
|
||||
{ "gamt", 0, -32400, "Pacific/Gambier" },
|
||||
{ "gbgt", 0, -13500, "America/Guyana" },
|
||||
{ "gft", 0, -14400, "America/Cayenne" },
|
||||
{ "gft", 0, -10800, "America/Cayenne" },
|
||||
{ "ghst", 1, 1200, "Africa/Accra" },
|
||||
{ "gilt", 0, 43200, "Pacific/Tarawa" },
|
||||
{ "gmt", 0, 0, "Africa/Abidjan" },
|
||||
{ "gmt", 0, 0, "Africa/Accra" },
|
||||
{ "gmt", 0, 0, "Africa/Bamako" },
|
||||
@@ -927,16 +672,8 @@
|
||||
{ "gmt", 0, 0, "Europe/Jersey" },
|
||||
{ "gmt", 0, 0, "Europe/London" },
|
||||
{ "gmt", 0, 0, "GB" },
|
||||
{ "gst", 0, 14400, "Asia/Dubai" },
|
||||
{ "gst", 0, -7200, "Atlantic/South_Georgia" },
|
||||
{ "gst", 0, 14400, "Asia/Bahrain" },
|
||||
{ "gst", 0, 14400, "Asia/Muscat" },
|
||||
{ "gst", 0, 14400, "Asia/Qatar" },
|
||||
{ "gst", 0, 36000, "Pacific/Guam" },
|
||||
{ "gst", 0, 36000, "Pacific/Saipan" },
|
||||
{ "gyt", 0, -14400, "America/Guyana" },
|
||||
{ "gyt", 0, -10800, "America/Guyana" },
|
||||
{ "gyt", 0, -13500, "America/Guyana" },
|
||||
{ "hdt", 1, -34200, "Pacific/Honolulu" },
|
||||
{ "hdt", 1, -32400, "America/Adak" },
|
||||
{ "hdt", 1, -32400, "America/Atka" },
|
||||
@@ -951,95 +688,41 @@
|
||||
{ "hmt", 0, 21200, "Asia/Kolkata" },
|
||||
{ "hmt", 0, 5989, "Europe/Helsinki" },
|
||||
{ "hmt", 0, 5989, "Europe/Mariehamn" },
|
||||
{ "hovst", 1, 28800, "Asia/Hovd" },
|
||||
{ "hovt", 0, 25200, "Asia/Hovd" },
|
||||
{ "hovt", 0, 21600, "Asia/Hovd" },
|
||||
{ "hst", 0, -36000, "Pacific/Honolulu" },
|
||||
{ "hst", 0, -37800, "Pacific/Honolulu" },
|
||||
{ "hst", 0, -36000, "America/Adak" },
|
||||
{ "hst", 0, -36000, "America/Atka" },
|
||||
{ "hst", 0, -36000, "Pacific/Johnston" },
|
||||
{ "hst", 0, -37800, "Pacific/Johnston" },
|
||||
{ "ict", 0, 25200, "Asia/Bangkok" },
|
||||
{ "ict", 0, 25200, "Asia/Ho_Chi_Minh" },
|
||||
{ "ict", 0, 25200, "Asia/Phnom_Penh" },
|
||||
{ "ict", 0, 25200, "Asia/Saigon" },
|
||||
{ "ict", 0, 25200, "Asia/Vientiane" },
|
||||
{ "iddt", 1, 14400, "Asia/Jerusalem" },
|
||||
{ "iddt", 1, 14400, "Asia/Tel_Aviv" },
|
||||
{ "idt", 1, 10800, "Asia/Jerusalem" },
|
||||
{ "idt", 1, 10800, "Asia/Gaza" },
|
||||
{ "idt", 1, 10800, "Asia/Hebron" },
|
||||
{ "idt", 1, 10800, "Asia/Tel_Aviv" },
|
||||
{ "idt", 0, 28800, "Asia/Ho_Chi_Minh" },
|
||||
{ "idt", 0, 28800, "Asia/Saigon" },
|
||||
{ "ihst", 1, 21600, "Asia/Colombo" },
|
||||
{ "imt", 0, 25025, "Asia/Irkutsk" },
|
||||
{ "imt", 0, 7016, "Asia/Istanbul" },
|
||||
{ "imt", 0, 7016, "Europe/Istanbul" },
|
||||
{ "imt", 0, 7016, "Europe/Sofia" },
|
||||
{ "iot", 0, 21600, "Indian/Chagos" },
|
||||
{ "iot", 0, 18000, "Indian/Chagos" },
|
||||
{ "irdt", 1, 16200, "Asia/Tehran" },
|
||||
{ "irdt", 1, 18000, "Asia/Tehran" },
|
||||
{ "irst", 0, 12600, "Asia/Tehran" },
|
||||
{ "irst", 0, 14400, "Asia/Tehran" },
|
||||
{ "isst", 1, 0, "Atlantic/Reykjavik" },
|
||||
{ "ist", 0, 7200, "Asia/Jerusalem" },
|
||||
{ "ist", 0, -3600, "Atlantic/Reykjavik" },
|
||||
{ "ist", 0, 19800, "Asia/Calcutta" },
|
||||
{ "ist", 0, 19800, "Asia/Colombo" },
|
||||
{ "ist", 0, 19800, "Asia/Dacca" },
|
||||
{ "ist", 0, 19800, "Asia/Dhaka" },
|
||||
{ "ist", 0, 19800, "Asia/Karachi" },
|
||||
{ "ist", 0, 19800, "Asia/Kathmandu" },
|
||||
{ "ist", 0, 19800, "Asia/Katmandu" },
|
||||
{ "ist", 0, 19800, "Asia/Kolkata" },
|
||||
{ "ist", 0, 19800, "Asia/Thimbu" },
|
||||
{ "ist", 0, 19800, "Asia/Thimphu" },
|
||||
{ "ist", 1, 2079, "Europe/Dublin" },
|
||||
{ "ist", 1, 23400, "Asia/Calcutta" },
|
||||
{ "ist", 1, 23400, "Asia/Colombo" },
|
||||
{ "ist", 1, 23400, "Asia/Karachi" },
|
||||
{ "ist", 1, 23400, "Asia/Kolkata" },
|
||||
{ "ist", 0, 3600, "Europe/Dublin" },
|
||||
{ "ist", 1, 3600, "Europe/Dublin" },
|
||||
{ "ist", 0, 7200, "Asia/Gaza" },
|
||||
{ "ist", 0, 7200, "Asia/Hebron" },
|
||||
{ "ist", 0, 7200, "Asia/Tel_Aviv" },
|
||||
{ "javt", 0, 26400, "Asia/Jakarta" },
|
||||
{ "jcst", 0, 32400, "Asia/Pyongyang" },
|
||||
{ "jcst", 0, 32400, "Asia/Seoul" },
|
||||
{ "jcst", 0, 32400, "Asia/Tokyo" },
|
||||
{ "jcst", 0, 32400, "ROK" },
|
||||
{ "jdt", 1, 36000, "Asia/Tokyo" },
|
||||
{ "jmt", 0, 8440, "Asia/Jerusalem" },
|
||||
{ "jmt", 0, 8440, "Asia/Tel_Aviv" },
|
||||
{ "jst", 0, 32400, "Asia/Tokyo" },
|
||||
{ "jst", 0, 32400, "Asia/Dili" },
|
||||
{ "jst", 0, 32400, "Asia/Ho_Chi_Minh" },
|
||||
{ "jst", 0, 32400, "Asia/Hong_Kong" },
|
||||
{ "jst", 0, 32400, "Asia/Jakarta" },
|
||||
{ "jst", 0, 32400, "Asia/Kuala_Lumpur" },
|
||||
{ "jst", 0, 32400, "Asia/Kuching" },
|
||||
{ "jst", 0, 32400, "Asia/Makassar" },
|
||||
{ "jst", 0, 32400, "Asia/Manila" },
|
||||
{ "jst", 0, 32400, "Asia/Pontianak" },
|
||||
{ "jst", 0, 32400, "Asia/Pyongyang" },
|
||||
{ "jst", 0, 32400, "Asia/Rangoon" },
|
||||
{ "jst", 0, 32400, "Asia/Saigon" },
|
||||
{ "jst", 0, 32400, "Asia/Seoul" },
|
||||
{ "jst", 0, 32400, "Asia/Singapore" },
|
||||
{ "jst", 0, 32400, "Asia/Taipei" },
|
||||
{ "jst", 0, 32400, "Asia/Ujung_Pandang" },
|
||||
{ "jst", 0, 32400, "Asia/Yangon" },
|
||||
{ "jst", 0, 32400, "Pacific/Bougainville" },
|
||||
{ "jst", 0, 32400, "Pacific/Nauru" },
|
||||
{ "jst", 0, 32400, "ROC" },
|
||||
{ "jst", 0, 32400, "ROK" },
|
||||
{ "jwst", 0, 28800, "Asia/Taipei" },
|
||||
{ "jwst", 0, 28800, "ROC" },
|
||||
{ "kart", 0, 18000, "Asia/Karachi" },
|
||||
{ "kdt", 1, 36000, "Asia/Seoul" },
|
||||
{ "kdt", 1, 34200, "Asia/Seoul" },
|
||||
{ "kdt", 1, 34200, "ROK" },
|
||||
@@ -1048,40 +731,13 @@
|
||||
{ "kmt", 0, -18431, "America/Grand_Turk" },
|
||||
{ "kmt", 0, -18431, "America/Jamaica" },
|
||||
{ "kmt", 0, 7324, "Europe/Kiev" },
|
||||
{ "kost", 0, 43200, "Pacific/Kosrae" },
|
||||
{ "kost", 0, 39600, "Pacific/Kosrae" },
|
||||
{ "kst", 0, 30600, "Asia/Seoul" },
|
||||
{ "kst", 0, 32400, "Asia/Pyongyang" },
|
||||
{ "kst", 0, 32400, "Asia/Seoul" },
|
||||
{ "kst", 0, 30600, "Asia/Pyongyang" },
|
||||
{ "kst", 0, 30600, "ROK" },
|
||||
{ "kst", 0, 32400, "ROK" },
|
||||
{ "kwat", 0, -43200, "Pacific/Kwajalein" },
|
||||
{ "lhdt", 1, 39600, "Australia/LHI" },
|
||||
{ "lhdt", 1, 39600, "Australia/Lord_Howe" },
|
||||
{ "lhdt", 1, 41400, "Australia/LHI" },
|
||||
{ "lhdt", 1, 41400, "Australia/Lord_Howe" },
|
||||
{ "lhst", 0, 37800, "Australia/Lord_Howe" },
|
||||
{ "lhst", 0, 37800, "Australia/LHI" },
|
||||
{ "lint", 0, 50400, "Pacific/Kiritimati" },
|
||||
{ "lint", 0, -36000, "Pacific/Kiritimati" },
|
||||
{ "lint", 0, -38400, "Pacific/Kiritimati" },
|
||||
{ "lkt", 0, 23400, "Asia/Colombo" },
|
||||
{ "lkt", 0, 21600, "Asia/Colombo" },
|
||||
{ "lrt", 0, -2670, "Africa/Monrovia" },
|
||||
{ "lst", 1, 9394, "Europe/Riga" },
|
||||
{ "madmt", 1, 3600, "Atlantic/Madeira" },
|
||||
{ "madst", 1, 0, "Atlantic/Madeira" },
|
||||
{ "madt", 0, -3600, "Atlantic/Madeira" },
|
||||
{ "malst", 1, 26400, "Asia/Singapore" },
|
||||
{ "malst", 1, 26400, "Asia/Kuala_Lumpur" },
|
||||
{ "malt", 0, 27000, "Asia/Singapore" },
|
||||
{ "malt", 0, 25200, "Asia/Singapore" },
|
||||
{ "malt", 0, 26400, "Asia/Singapore" },
|
||||
{ "malt", 0, 25200, "Asia/Kuala_Lumpur" },
|
||||
{ "malt", 0, 26400, "Asia/Kuala_Lumpur" },
|
||||
{ "malt", 0, 27000, "Asia/Kuala_Lumpur" },
|
||||
{ "mart", 0, -34200, "Pacific/Marquesas" },
|
||||
{ "mddt", 1, -18000, "America/Cambridge_Bay" },
|
||||
{ "mddt", 1, -18000, "America/Yellowknife" },
|
||||
{ "mdst", 1, 16279, "Europe/Moscow" },
|
||||
@@ -1103,33 +759,22 @@
|
||||
{ "mdt", 1, -21600, "America/Shiprock" },
|
||||
{ "mdt", 1, -21600, "America/Swift_Current" },
|
||||
{ "mdt", 1, -21600, "America/Yellowknife" },
|
||||
{ "mdt", 1, -21600, "Canada/East-Saskatchewan" },
|
||||
{ "mdt", 1, -21600, "Canada/Mountain" },
|
||||
{ "mdt", 1, -21600, "Canada/Saskatchewan" },
|
||||
{ "mdt", 1, -21600, "Mexico/BajaSur" },
|
||||
{ "mest", 1, 7200, "MET" },
|
||||
{ "met", 0, 3600, "MET" },
|
||||
{ "mht", 0, 43200, "Pacific/Kwajalein" },
|
||||
{ "mht", 0, 39600, "Pacific/Kwajalein" },
|
||||
{ "mht", 0, 39600, "Pacific/Majuro" },
|
||||
{ "mht", 0, 43200, "Pacific/Majuro" },
|
||||
{ "mist", 0, 39600, "Antarctica/Macquarie" },
|
||||
{ "mmt", 0, 9017, "Europe/Moscow" },
|
||||
{ "mmt", 0, 9079, "Europe/Moscow" },
|
||||
{ "mmt", 0, -13484, "America/Montevideo" },
|
||||
{ "mmt", 0, -20712, "America/Managua" },
|
||||
{ "mmt", 0, -2588, "Africa/Monrovia" },
|
||||
{ "mmt", 0, -2670, "Africa/Monrovia" },
|
||||
{ "mmt", 0, 17640, "Indian/Maldives" },
|
||||
{ "mmt", 0, 19172, "Asia/Colombo" },
|
||||
{ "mmt", 0, 23400, "Asia/Rangoon" },
|
||||
{ "mmt", 0, 23400, "Asia/Yangon" },
|
||||
{ "mmt", 0, 19270, "Asia/Calcutta" },
|
||||
{ "mmt", 0, 19270, "Asia/Kolkata" },
|
||||
{ "mmt", 0, 28656, "Asia/Makassar" },
|
||||
{ "mmt", 0, 28656, "Asia/Ujung_Pandang" },
|
||||
{ "mmt", 0, 6600, "Europe/Minsk" },
|
||||
{ "most", 1, 32400, "Asia/Macao" },
|
||||
{ "most", 1, 32400, "Asia/Macau" },
|
||||
{ "mot", 0, 28800, "Asia/Macao" },
|
||||
{ "mot", 0, 28800, "Asia/Macau" },
|
||||
{ "mpt", 1, -21600, "America/Denver" },
|
||||
{ "mpt", 1, -21600, "America/Boise" },
|
||||
{ "mpt", 1, -21600, "America/Cambridge_Bay" },
|
||||
@@ -1141,7 +786,6 @@
|
||||
{ "mpt", 1, -21600, "America/Shiprock" },
|
||||
{ "mpt", 1, -21600, "America/Swift_Current" },
|
||||
{ "mpt", 1, -21600, "America/Yellowknife" },
|
||||
{ "mpt", 1, -21600, "Canada/East-Saskatchewan" },
|
||||
{ "mpt", 1, -21600, "Canada/Mountain" },
|
||||
{ "mpt", 1, -21600, "Canada/Saskatchewan" },
|
||||
{ "msd", 1, 14400, "Europe/Moscow" },
|
||||
@@ -1195,16 +839,12 @@
|
||||
{ "mst", 0, -25200, "America/Swift_Current" },
|
||||
{ "mst", 0, -25200, "America/Tijuana" },
|
||||
{ "mst", 0, -25200, "America/Yellowknife" },
|
||||
{ "mst", 0, -25200, "Canada/East-Saskatchewan" },
|
||||
{ "mst", 0, -25200, "Canada/Mountain" },
|
||||
{ "mst", 0, -25200, "Canada/Saskatchewan" },
|
||||
{ "mst", 0, -25200, "Mexico/BajaNorte" },
|
||||
{ "mst", 0, -25200, "Mexico/BajaSur" },
|
||||
{ "mst", 0, -25200, "Mexico/General" },
|
||||
{ "mst", 1, 12679, "Europe/Moscow" },
|
||||
{ "must", 1, 18000, "Indian/Mauritius" },
|
||||
{ "mut", 0, 14400, "Indian/Mauritius" },
|
||||
{ "mvt", 0, 18000, "Indian/Maldives" },
|
||||
{ "mwt", 1, -21600, "America/Denver" },
|
||||
{ "mwt", 1, -21600, "America/Boise" },
|
||||
{ "mwt", 1, -21600, "America/Cambridge_Bay" },
|
||||
@@ -1217,13 +857,8 @@
|
||||
{ "mwt", 1, -21600, "America/Shiprock" },
|
||||
{ "mwt", 1, -21600, "America/Swift_Current" },
|
||||
{ "mwt", 1, -21600, "America/Yellowknife" },
|
||||
{ "mwt", 1, -21600, "Canada/East-Saskatchewan" },
|
||||
{ "mwt", 1, -21600, "Canada/Mountain" },
|
||||
{ "mwt", 1, -21600, "Canada/Saskatchewan" },
|
||||
{ "myt", 0, 28800, "Asia/Kuala_Lumpur" },
|
||||
{ "myt", 0, 28800, "Asia/Kuching" },
|
||||
{ "ncst", 1, 43200, "Pacific/Noumea" },
|
||||
{ "nct", 0, 39600, "Pacific/Noumea" },
|
||||
{ "nddt", 1, -5400, "America/St_Johns" },
|
||||
{ "nddt", 1, -5400, "Canada/Newfoundland" },
|
||||
{ "ndt", 1, -9052, "America/St_Johns" },
|
||||
@@ -1232,23 +867,12 @@
|
||||
{ "ndt", 1, -9000, "Canada/Newfoundland" },
|
||||
{ "ndt", 1, -9052, "America/Goose_Bay" },
|
||||
{ "ndt", 1, -9052, "Canada/Newfoundland" },
|
||||
{ "negt", 0, -12600, "America/Paramaribo" },
|
||||
{ "nest", 1, 4800, "Europe/Amsterdam" },
|
||||
{ "net", 0, 1200, "Europe/Amsterdam" },
|
||||
{ "nfst", 1, 45000, "Pacific/Norfolk" },
|
||||
{ "nft", 0, 41400, "Pacific/Norfolk" },
|
||||
{ "nft", 0, 39600, "Pacific/Norfolk" },
|
||||
{ "nmt", 0, 40320, "Pacific/Norfolk" },
|
||||
{ "npt", 1, -9000, "America/St_Johns" },
|
||||
{ "npt", 0, 20700, "Asia/Katmandu" },
|
||||
{ "npt", 1, -36000, "America/Adak" },
|
||||
{ "npt", 1, -36000, "America/Atka" },
|
||||
{ "npt", 1, -36000, "America/Nome" },
|
||||
{ "npt", 1, -9000, "America/Goose_Bay" },
|
||||
{ "npt", 1, -9000, "Canada/Newfoundland" },
|
||||
{ "npt", 0, 20700, "Asia/Kathmandu" },
|
||||
{ "nrt", 0, 43200, "Pacific/Nauru" },
|
||||
{ "nrt", 0, 41400, "Pacific/Nauru" },
|
||||
{ "nst", 0, -12600, "America/St_Johns" },
|
||||
{ "nst", 0, -12652, "America/St_Johns" },
|
||||
{ "nst", 1, 4772, "Europe/Amsterdam" },
|
||||
@@ -1259,12 +883,6 @@
|
||||
{ "nst", 0, -39600, "America/Adak" },
|
||||
{ "nst", 0, -39600, "America/Atka" },
|
||||
{ "nst", 0, -39600, "America/Nome" },
|
||||
{ "nst", 0, -39600, "Pacific/Midway" },
|
||||
{ "nst", 0, -39600, "Pacific/Pago_Pago" },
|
||||
{ "nst", 0, -39600, "Pacific/Samoa" },
|
||||
{ "nut", 0, -39600, "Pacific/Niue" },
|
||||
{ "nut", 0, -40800, "Pacific/Niue" },
|
||||
{ "nut", 0, -41400, "Pacific/Niue" },
|
||||
{ "nwt", 1, -9000, "America/St_Johns" },
|
||||
{ "nwt", 1, -36000, "America/Adak" },
|
||||
{ "nwt", 1, -36000, "America/Atka" },
|
||||
@@ -1308,22 +926,12 @@
|
||||
{ "pdt", 1, -25200, "Canada/Pacific" },
|
||||
{ "pdt", 1, -25200, "Canada/Yukon" },
|
||||
{ "pdt", 1, -25200, "Mexico/BajaNorte" },
|
||||
{ "pest", 1, -14400, "America/Lima" },
|
||||
{ "pet", 0, -18000, "America/Lima" },
|
||||
{ "pgt", 0, 36000, "Pacific/Bougainville" },
|
||||
{ "pgt", 0, 36000, "Pacific/Port_Moresby" },
|
||||
{ "phot", 0, 46800, "Pacific/Enderbury" },
|
||||
{ "phot", 0, -39600, "Pacific/Enderbury" },
|
||||
{ "phot", 0, -43200, "Pacific/Enderbury" },
|
||||
{ "phst", 1, 32400, "Asia/Manila" },
|
||||
{ "pht", 0, 28800, "Asia/Manila" },
|
||||
{ "pkst", 1, 21600, "Asia/Karachi" },
|
||||
{ "pkt", 0, 18000, "Asia/Karachi" },
|
||||
{ "plmt", 0, 25590, "Asia/Ho_Chi_Minh" },
|
||||
{ "plmt", 0, 25590, "Asia/Saigon" },
|
||||
{ "pmdt", 1, -7200, "America/Miquelon" },
|
||||
{ "pmmt", 0, 35312, "Pacific/Bougainville" },
|
||||
{ "pmst", 0, -10800, "America/Miquelon" },
|
||||
{ "pmmt", 0, 35312, "Pacific/Port_Moresby" },
|
||||
{ "pmt", 0, -13236, "America/Paramaribo" },
|
||||
{ "pmt", 0, -13252, "America/Paramaribo" },
|
||||
{ "pmt", 0, 13505, "Asia/Yekaterinburg" },
|
||||
@@ -1334,9 +942,6 @@
|
||||
{ "pmt", 0, 561, "Africa/Tunis" },
|
||||
{ "pmt", 0, 561, "Europe/Monaco" },
|
||||
{ "pmt", 0, 561, "Europe/Paris" },
|
||||
{ "pnt", 0, -30600, "Pacific/Pitcairn" },
|
||||
{ "pont", 0, 39600, "Pacific/Pohnpei" },
|
||||
{ "pont", 0, 39600, "Pacific/Ponape" },
|
||||
{ "ppmt", 0, -17340, "America/Port-au-Prince" },
|
||||
{ "ppt", 1, -25200, "America/Los_Angeles" },
|
||||
{ "ppt", 1, -25200, "America/Dawson_Creek" },
|
||||
@@ -1372,7 +977,6 @@
|
||||
{ "pst", 0, -28800, "Canada/Yukon" },
|
||||
{ "pst", 0, -28800, "Mexico/BajaNorte" },
|
||||
{ "pst", 0, -28800, "Mexico/BajaSur" },
|
||||
{ "pst", 0, -28800, "Pacific/Pitcairn" },
|
||||
{ "pwt", 1, -25200, "America/Los_Angeles" },
|
||||
{ "pwt", 1, -25200, "America/Dawson_Creek" },
|
||||
{ "pwt", 1, -25200, "America/Ensenada" },
|
||||
@@ -1385,15 +989,10 @@
|
||||
{ "pwt", 1, -25200, "America/Vancouver" },
|
||||
{ "pwt", 1, -25200, "Canada/Pacific" },
|
||||
{ "pwt", 1, -25200, "Mexico/BajaNorte" },
|
||||
{ "pwt", 0, 32400, "Pacific/Palau" },
|
||||
{ "pyst", 1, -10800, "America/Asuncion" },
|
||||
{ "pyt", 0, -14400, "America/Asuncion" },
|
||||
{ "pyt", 0, -10800, "America/Asuncion" },
|
||||
{ "qmt", 0, -18840, "America/Guayaquil" },
|
||||
{ "ret", 0, 14400, "Indian/Reunion" },
|
||||
{ "rmt", 0, 5794, "Europe/Riga" },
|
||||
{ "rmt", 0, 23080, "Asia/Rangoon" },
|
||||
{ "rmt", 0, 23080, "Asia/Yangon" },
|
||||
{ "rmt", 0, 23087, "Asia/Rangoon" },
|
||||
{ "rmt", 0, 23087, "Asia/Yangon" },
|
||||
{ "rmt", 0, 2996, "Europe/Rome" },
|
||||
{ "rmt", 0, 2996, "Europe/San_Marino" },
|
||||
{ "rmt", 0, 2996, "Europe/Vatican" },
|
||||
@@ -1408,90 +1007,31 @@
|
||||
{ "sast", 0, 7200, "Africa/Maseru" },
|
||||
{ "sast", 0, 7200, "Africa/Mbabane" },
|
||||
{ "sast", 0, 7200, "Africa/Windhoek" },
|
||||
{ "sbt", 0, 39600, "Pacific/Guadalcanal" },
|
||||
{ "sct", 0, 14400, "Indian/Mahe" },
|
||||
{ "sdmt", 0, -16800, "America/Santo_Domingo" },
|
||||
{ "sdt", 1, -36000, "Pacific/Apia" },
|
||||
{ "set", 0, 3614, "Europe/Stockholm" },
|
||||
{ "sgt", 0, 28800, "Asia/Singapore" },
|
||||
{ "sgt", 0, 27000, "Asia/Singapore" },
|
||||
{ "sjmt", 0, -20173, "America/Costa_Rica" },
|
||||
{ "smt", 0, -13884, "Atlantic/Stanley" },
|
||||
{ "smt", 0, -16966, "America/Punta_Arenas" },
|
||||
{ "smt", 0, -16966, "America/Santiago" },
|
||||
{ "smt", 0, -16966, "Chile/Continental" },
|
||||
{ "smt", 0, 24925, "Asia/Kuala_Lumpur" },
|
||||
{ "smt", 0, 24925, "Asia/Singapore" },
|
||||
{ "smt", 0, 8160, "Europe/Simferopol" },
|
||||
{ "srt", 0, -10800, "America/Paramaribo" },
|
||||
{ "srt", 0, -12600, "America/Paramaribo" },
|
||||
{ "sst", 0, -39600, "Pacific/Samoa" },
|
||||
{ "sst", 0, -39600, "Pacific/Apia" },
|
||||
{ "sst", 0, -39600, "Pacific/Midway" },
|
||||
{ "sst", 0, -39600, "Pacific/Pago_Pago" },
|
||||
{ "swat", 0, 5400, "Africa/Windhoek" },
|
||||
{ "taht", 0, -36000, "Pacific/Tahiti" },
|
||||
{ "tbmt", 0, 10751, "Asia/Tbilisi" },
|
||||
{ "tkt", 0, -39600, "Pacific/Fakaofo" },
|
||||
{ "tkt", 0, 46800, "Pacific/Fakaofo" },
|
||||
{ "tlt", 0, 32400, "Asia/Dili" },
|
||||
{ "tlt", 0, 28800, "Asia/Dili" },
|
||||
{ "tmt", 0, 12344, "Asia/Tehran" },
|
||||
{ "tmt", 0, 5940, "Europe/Tallinn" },
|
||||
{ "tost", 1, 50400, "Pacific/Tongatapu" },
|
||||
{ "tot", 0, 46800, "Pacific/Tongatapu" },
|
||||
{ "tot", 0, 44400, "Pacific/Tongatapu" },
|
||||
{ "tvt", 0, 43200, "Pacific/Funafuti" },
|
||||
{ "uct", 0, 0, "Etc/UCT" },
|
||||
{ "ulast", 1, 32400, "Asia/Ulaanbaatar" },
|
||||
{ "ulast", 1, 32400, "Asia/Ulan_Bator" },
|
||||
{ "ulat", 0, 28800, "Asia/Ulaanbaatar" },
|
||||
{ "ulat", 0, 25200, "Asia/Ulaanbaatar" },
|
||||
{ "ulat", 0, 25200, "Asia/Choibalsan" },
|
||||
{ "ulat", 0, 25200, "Asia/Ulan_Bator" },
|
||||
{ "ulat", 0, 28800, "Asia/Choibalsan" },
|
||||
{ "ulat", 0, 28800, "Asia/Ulan_Bator" },
|
||||
{ "utc", 0, 0, "Etc/Universal" },
|
||||
{ "utc", 0, 0, "Etc/UTC" },
|
||||
{ "utc", 0, 0, "Etc/Zulu" },
|
||||
{ "utc", 0, 0, "UTC" },
|
||||
{ "utc", 0, 0, "UTC" },
|
||||
{ "uyhst", 1, -9000, "America/Montevideo" },
|
||||
{ "uyhst", 1, -10800, "America/Montevideo" },
|
||||
{ "uyst", 1, -7200, "America/Montevideo" },
|
||||
{ "uyt", 0, -10800, "America/Montevideo" },
|
||||
{ "uyt", 0, -12600, "America/Montevideo" },
|
||||
{ "vet", 0, -16200, "America/Caracas" },
|
||||
{ "vet", 0, -14400, "America/Caracas" },
|
||||
{ "vust", 1, 43200, "Pacific/Efate" },
|
||||
{ "vut", 0, 39600, "Pacific/Efate" },
|
||||
{ "wakt", 0, 43200, "Pacific/Wake" },
|
||||
{ "warst", 1, -10800, "America/Mendoza" },
|
||||
{ "warst", 1, -10800, "America/Argentina/Jujuy" },
|
||||
{ "warst", 1, -10800, "America/Argentina/Mendoza" },
|
||||
{ "warst", 1, -10800, "America/Argentina/San_Luis" },
|
||||
{ "warst", 1, -10800, "America/Jujuy" },
|
||||
{ "wart", 0, -14400, "America/Mendoza" },
|
||||
{ "wart", 0, -14400, "America/Argentina/Catamarca" },
|
||||
{ "wart", 0, -14400, "America/Argentina/ComodRivadavia" },
|
||||
{ "wart", 0, -14400, "America/Argentina/Cordoba" },
|
||||
{ "wart", 0, -14400, "America/Argentina/Jujuy" },
|
||||
{ "wart", 0, -14400, "America/Argentina/La_Rioja" },
|
||||
{ "wart", 0, -14400, "America/Argentina/Mendoza" },
|
||||
{ "wart", 0, -14400, "America/Argentina/Rio_Gallegos" },
|
||||
{ "wart", 0, -14400, "America/Argentina/Salta" },
|
||||
{ "wart", 0, -14400, "America/Argentina/San_Juan" },
|
||||
{ "wart", 0, -14400, "America/Argentina/San_Luis" },
|
||||
{ "wart", 0, -14400, "America/Argentina/Tucuman" },
|
||||
{ "wart", 0, -14400, "America/Argentina/Ushuaia" },
|
||||
{ "wart", 0, -14400, "America/Catamarca" },
|
||||
{ "wart", 0, -14400, "America/Cordoba" },
|
||||
{ "wart", 0, -14400, "America/Jujuy" },
|
||||
{ "wart", 0, -14400, "America/Rosario" },
|
||||
{ "wast", 1, 7200, "Africa/Windhoek" },
|
||||
{ "wast", 1, 7200, "Africa/Ndjamena" },
|
||||
{ "wat", 0, 3600, "Africa/Brazzaville" },
|
||||
{ "wat", 0, -3600, "Africa/Bissau" },
|
||||
{ "wat", 0, -3600, "Africa/El_Aaiun" },
|
||||
{ "wat", 0, 3600, "Africa/Bangui" },
|
||||
{ "wat", 0, 3600, "Africa/Douala" },
|
||||
{ "wat", 0, 3600, "Africa/Kinshasa" },
|
||||
@@ -1539,29 +1079,14 @@
|
||||
{ "wet", 0, 0, "Europe/Luxembourg" },
|
||||
{ "wet", 0, 0, "Europe/Madrid" },
|
||||
{ "wet", 0, 0, "Europe/Monaco" },
|
||||
{ "wft", 0, 43200, "Pacific/Wallis" },
|
||||
{ "wgst", 1, -7200, "America/Godthab" },
|
||||
{ "wgst", 1, -7200, "America/Danmarkshavn" },
|
||||
{ "wgt", 0, -10800, "America/Godthab" },
|
||||
{ "wgt", 0, -10800, "America/Danmarkshavn" },
|
||||
{ "wib", 0, 25200, "Asia/Jakarta" },
|
||||
{ "wib", 0, 25200, "Asia/Pontianak" },
|
||||
{ "wib", 0, 27000, "Asia/Jakarta" },
|
||||
{ "wib", 0, 27000, "Asia/Pontianak" },
|
||||
{ "wib", 0, 28800, "Asia/Jakarta" },
|
||||
{ "wib", 0, 28800, "Asia/Pontianak" },
|
||||
{ "wita", 0, 28800, "Asia/Dili" },
|
||||
{ "wita", 0, 28800, "Asia/Makassar" },
|
||||
{ "wita", 0, 28800, "Asia/Pontianak" },
|
||||
{ "wita", 0, 28800, "Asia/Ujung_Pandang" },
|
||||
{ "wit", 0, 32400, "Asia/Jayapura" },
|
||||
{ "wmt", 0, 5040, "Europe/Vilnius" },
|
||||
{ "wmt", 0, 5040, "Europe/Warsaw" },
|
||||
{ "wsdt", 1, 50400, "Pacific/Apia" },
|
||||
{ "wsst", 0, -41400, "Pacific/Apia" },
|
||||
{ "wsst", 0, 46800, "Pacific/Apia" },
|
||||
{ "xjt", 0, 21600, "Asia/Kashgar" },
|
||||
{ "xjt", 0, 21600, "Asia/Urumqi" },
|
||||
{ "yddt", 1, -25200, "America/Dawson" },
|
||||
{ "yddt", 1, -25200, "America/Whitehorse" },
|
||||
{ "yddt", 1, -25200, "Canada/Yukon" },
|
||||
|
||||
+48
-15
@@ -23,6 +23,7 @@
|
||||
*/
|
||||
|
||||
#include "timelib.h"
|
||||
#include "timelib_private.h"
|
||||
|
||||
/* jan feb mrt apr may jun jul aug sep oct nov dec */
|
||||
static int month_tab_leap[12] = { -1, 30, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 };
|
||||
@@ -32,14 +33,14 @@ static int month_tab[12] = { 0, 31, 59, 90, 120, 151, 181, 212, 24
|
||||
static int days_in_month_leap[13] = { 31, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
|
||||
static int days_in_month[13] = { 31, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
|
||||
|
||||
static void do_range_limit_fraction(double *fraction, timelib_sll *seconds)
|
||||
static void do_range_limit_fraction(timelib_sll *fraction, timelib_sll *seconds)
|
||||
{
|
||||
if (*fraction < 0) {
|
||||
*fraction += 1;
|
||||
*fraction += 1000000;
|
||||
*seconds -= 1;
|
||||
}
|
||||
if (*fraction > 1) {
|
||||
*fraction -= 1;
|
||||
if (*fraction > 1000000) {
|
||||
*fraction -= 1000000;
|
||||
*seconds += 1;
|
||||
}
|
||||
}
|
||||
@@ -202,14 +203,47 @@ void timelib_do_rel_normalize(timelib_time *base, timelib_rel_time *rt)
|
||||
do_range_limit(0, 12, 12, &rt->m, &rt->y);
|
||||
}
|
||||
|
||||
#define EPOCH_DAY 719468
|
||||
|
||||
static void magic_date_calc(timelib_time *time)
|
||||
{
|
||||
timelib_sll y, ddd, mi, mm, dd, g;
|
||||
|
||||
/* The algorithm doesn't work before the year 1 */
|
||||
if (time->d < -719498) {
|
||||
return;
|
||||
}
|
||||
|
||||
g = time->d + EPOCH_DAY - 1;
|
||||
|
||||
y = (10000 * g + 14780) / 3652425;
|
||||
ddd = g - ((365*y) + (y/4) - (y/100) + (y/400));
|
||||
if (ddd < 0) {
|
||||
y--;
|
||||
ddd = g - ((365*y) + (y/4) - (y/100) + (y/400));
|
||||
}
|
||||
mi = (100 * ddd + 52) / 3060;
|
||||
mm = ((mi + 2) % 12) + 1;
|
||||
y = y + (mi + 2) / 12;
|
||||
dd = ddd - ((mi * 306 + 5) / 10) + 1;
|
||||
time->y = y;
|
||||
time->m = mm;
|
||||
time->d = dd;
|
||||
}
|
||||
|
||||
void timelib_do_normalize(timelib_time* time)
|
||||
{
|
||||
if (time->f != TIMELIB_UNSET) do_range_limit_fraction(&time->f, &time->s);
|
||||
if (time->us != TIMELIB_UNSET) do_range_limit_fraction(&time->us, &time->s);
|
||||
if (time->s != TIMELIB_UNSET) do_range_limit(0, 60, 60, &time->s, &time->i);
|
||||
if (time->s != TIMELIB_UNSET) do_range_limit(0, 60, 60, &time->i, &time->h);
|
||||
if (time->s != TIMELIB_UNSET) do_range_limit(0, 24, 24, &time->h, &time->d);
|
||||
do_range_limit(1, 13, 12, &time->m, &time->y);
|
||||
|
||||
/* Short cut if we're doing things against the Epoch */
|
||||
if (time->y == 1970 && time->m == 1 && time->d != 1) {
|
||||
magic_date_calc(time);
|
||||
}
|
||||
|
||||
do {} while (do_range_limit_days(&time->y, &time->m, &time->d));
|
||||
do_range_limit(1, 13, 12, &time->m, &time->y);
|
||||
}
|
||||
@@ -222,7 +256,7 @@ static void do_adjust_relative(timelib_time* time)
|
||||
timelib_do_normalize(time);
|
||||
|
||||
if (time->have_relative) {
|
||||
time->f += time->relative.f;
|
||||
time->us += time->relative.us;
|
||||
|
||||
time->s += time->relative.s;
|
||||
time->i += time->relative.i;
|
||||
@@ -399,16 +433,15 @@ static timelib_sll do_adjust_timezone(timelib_time *tz, timelib_tzinfo *tzi)
|
||||
case TIMELIB_ZONETYPE_OFFSET:
|
||||
|
||||
tz->is_localtime = 1;
|
||||
return tz->z * 60;
|
||||
return -tz->z;
|
||||
break;
|
||||
|
||||
case TIMELIB_ZONETYPE_ABBR: {
|
||||
timelib_sll tmp;
|
||||
|
||||
tz->is_localtime = 1;
|
||||
tmp = tz->z;
|
||||
tmp -= tz->dst * 60;
|
||||
tmp *= 60;
|
||||
tmp = -tz->z;
|
||||
tmp -= tz->dst * 3600;
|
||||
return tmp;
|
||||
}
|
||||
break;
|
||||
@@ -422,19 +455,19 @@ static timelib_sll do_adjust_timezone(timelib_time *tz, timelib_tzinfo *tzi)
|
||||
if (tzi) {
|
||||
timelib_time_offset *before, *after;
|
||||
timelib_sll tmp;
|
||||
int in_transistion;
|
||||
int in_transition;
|
||||
|
||||
tz->is_localtime = 1;
|
||||
before = timelib_get_time_zone_info(tz->sse, tzi);
|
||||
after = timelib_get_time_zone_info(tz->sse - before->offset, tzi);
|
||||
timelib_set_timezone(tz, tzi);
|
||||
|
||||
in_transistion = (
|
||||
((tz->sse - after->offset) >= (after->transistion_time + (before->offset - after->offset))) &&
|
||||
((tz->sse - after->offset) < after->transistion_time)
|
||||
in_transition = (
|
||||
((tz->sse - after->offset) >= (after->transition_time + (before->offset - after->offset))) &&
|
||||
((tz->sse - after->offset) < after->transition_time)
|
||||
);
|
||||
|
||||
if ((before->offset != after->offset) && !in_transistion) {
|
||||
if ((before->offset != after->offset) && !in_transition) {
|
||||
tmp = -after->offset;
|
||||
} else {
|
||||
tmp = -tz->z;
|
||||
|
||||
+18
-47
@@ -23,18 +23,7 @@
|
||||
*/
|
||||
|
||||
#include "timelib.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#else
|
||||
#include <strings.h>
|
||||
#endif
|
||||
#include "timelib_private.h"
|
||||
|
||||
static int month_tab_leap[12] = { -1, 30, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 };
|
||||
static int month_tab[12] = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 };
|
||||
@@ -59,12 +48,17 @@ void timelib_unixtime2gmt(timelib_time* tm, timelib_sll ts)
|
||||
|
||||
if (ts >= 0) {
|
||||
tmp_days = days + 1;
|
||||
} else {
|
||||
tmp_days = days;
|
||||
}
|
||||
|
||||
if (tmp_days >= DAYS_PER_LYEAR_PERIOD || tmp_days <= -DAYS_PER_LYEAR_PERIOD) {
|
||||
cur_year += YEARS_PER_LYEAR_PERIOD * (tmp_days / DAYS_PER_LYEAR_PERIOD);
|
||||
tmp_days -= DAYS_PER_LYEAR_PERIOD * (tmp_days / DAYS_PER_LYEAR_PERIOD);
|
||||
}
|
||||
if (tmp_days > DAYS_PER_LYEAR_PERIOD || tmp_days <= -DAYS_PER_LYEAR_PERIOD) {
|
||||
cur_year += YEARS_PER_LYEAR_PERIOD * (tmp_days / DAYS_PER_LYEAR_PERIOD);
|
||||
tmp_days -= DAYS_PER_LYEAR_PERIOD * (tmp_days / DAYS_PER_LYEAR_PERIOD);
|
||||
}
|
||||
TIMELIB_DEBUG(printf("tmp_days=%lld, year=%lld\n", tmp_days, cur_year););
|
||||
|
||||
if (ts >= 0) {
|
||||
while (tmp_days >= DAYS_PER_LYEAR) {
|
||||
cur_year++;
|
||||
if (timelib_is_leap(cur_year)) {
|
||||
@@ -72,33 +66,17 @@ void timelib_unixtime2gmt(timelib_time* tm, timelib_sll ts)
|
||||
} else {
|
||||
tmp_days -= DAYS_PER_YEAR;
|
||||
}
|
||||
TIMELIB_DEBUG(printf("tmp_days=%lld, year=%lld\n", tmp_days, cur_year););
|
||||
}
|
||||
} else {
|
||||
tmp_days = days;
|
||||
|
||||
/* Guess why this might be for, it has to do with a pope ;-). It's also
|
||||
* only valid for Great Brittain and it's colonies. It needs fixing for
|
||||
* other locales. *sigh*, why is this crap so complex! */
|
||||
/*
|
||||
if (ts <= TIMELIB_LL_CONST(-6857352000)) {
|
||||
tmp_days -= 11;
|
||||
}
|
||||
*/
|
||||
|
||||
while (tmp_days <= 0) {
|
||||
if (tmp_days < -1460970) {
|
||||
cur_year -= 4000;
|
||||
TIMELIB_DEBUG(printf("tmp_days=%lld, year=%lld\n", tmp_days, cur_year););
|
||||
tmp_days += 1460970;
|
||||
cur_year--;
|
||||
if (timelib_is_leap(cur_year)) {
|
||||
tmp_days += DAYS_PER_LYEAR;
|
||||
} else {
|
||||
cur_year--;
|
||||
TIMELIB_DEBUG(printf("tmp_days=%lld, year=%lld\n", tmp_days, cur_year););
|
||||
if (timelib_is_leap(cur_year)) {
|
||||
tmp_days += DAYS_PER_LYEAR;
|
||||
} else {
|
||||
tmp_days += DAYS_PER_YEAR;
|
||||
}
|
||||
tmp_days += DAYS_PER_YEAR;
|
||||
}
|
||||
TIMELIB_DEBUG(printf("tmp_days=%lld, year=%lld\n", tmp_days, cur_year););
|
||||
}
|
||||
remainder += SECS_PER_DAY;
|
||||
}
|
||||
@@ -149,7 +127,7 @@ void timelib_update_from_sse(timelib_time *tm)
|
||||
switch (tm->zone_type) {
|
||||
case TIMELIB_ZONETYPE_ABBR:
|
||||
case TIMELIB_ZONETYPE_OFFSET: {
|
||||
timelib_unixtime2gmt(tm, tm->sse - (tm->z * 60) + (tm->dst * 3600));
|
||||
timelib_unixtime2gmt(tm, tm->sse + tm->z + (tm->dst * 3600));
|
||||
|
||||
goto cleanup;
|
||||
}
|
||||
@@ -187,7 +165,7 @@ void timelib_unixtime2local(timelib_time *tm, timelib_sll ts)
|
||||
int z = tm->z;
|
||||
signed int dst = tm->dst;
|
||||
|
||||
timelib_unixtime2gmt(tm, ts - (tm->z * 60) + (tm->dst * 3600));
|
||||
timelib_unixtime2gmt(tm, ts + tm->z + (tm->dst * 3600));
|
||||
|
||||
tm->sse = ts;
|
||||
tm->z = z;
|
||||
@@ -295,10 +273,3 @@ int timelib_apply_localtime(timelib_time *t, unsigned int localtime)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if HAVE_GETTIMEOFDAY
|
||||
void timelib_set_fraction_from_timeval(timelib_time *t, struct timeval tp)
|
||||
{
|
||||
t->f = (double) tp.tv_usec / 1000000;
|
||||
}
|
||||
#endif
|
||||
+91
-43
@@ -29,6 +29,7 @@
|
||||
#include "php_date.h"
|
||||
#include "zend_interfaces.h"
|
||||
#include "lib/timelib.h"
|
||||
#include "lib/timelib_private.h"
|
||||
#ifndef PHP_WIN32
|
||||
#include <time.h>
|
||||
#else
|
||||
@@ -658,6 +659,7 @@ static HashTable *date_object_get_gc_timezone(zval *object, zval **table, int *n
|
||||
|
||||
zval *date_interval_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv);
|
||||
void date_interval_write_property(zval *object, zval *member, zval *value, void **cache_slot);
|
||||
static zval *date_interval_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot);
|
||||
static zval *date_period_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv);
|
||||
static void date_period_write_property(zval *object, zval *member, zval *value, void **cache_slot);
|
||||
|
||||
@@ -921,6 +923,7 @@ PHP_MINFO_FUNCTION(date)
|
||||
|
||||
php_info_print_table_start();
|
||||
php_info_print_table_row(2, "date/time support", "enabled");
|
||||
php_info_print_table_row(2, "timelib version", TIMELIB_ASCII_VERSION);
|
||||
php_info_print_table_row(2, "\"Olson\" Timezone Database Version", tzdb->version);
|
||||
php_info_print_table_row(2, "Timezone Database", php_date_global_timezone_db_enabled ? "external" : "internal");
|
||||
php_info_print_table_row(2, "Default timezone", guess_timezone(tzdb));
|
||||
@@ -934,6 +937,7 @@ PHP_MINFO_FUNCTION(date)
|
||||
static timelib_tzinfo *php_date_parse_tzfile(char *formal_tzname, const timelib_tzdb *tzdb)
|
||||
{
|
||||
timelib_tzinfo *tzi;
|
||||
int dummy_error_code;
|
||||
|
||||
if(!DATEG(tzcache)) {
|
||||
ALLOC_HASHTABLE(DATEG(tzcache));
|
||||
@@ -944,14 +948,14 @@ static timelib_tzinfo *php_date_parse_tzfile(char *formal_tzname, const timelib_
|
||||
return tzi;
|
||||
}
|
||||
|
||||
tzi = timelib_parse_tzfile(formal_tzname, tzdb);
|
||||
tzi = timelib_parse_tzfile(formal_tzname, tzdb, &dummy_error_code);
|
||||
if (tzi) {
|
||||
zend_hash_str_add_ptr(DATEG(tzcache), formal_tzname, strlen(formal_tzname), tzi);
|
||||
}
|
||||
return tzi;
|
||||
}
|
||||
|
||||
timelib_tzinfo *php_date_parse_tzfile_wrapper(char *formal_tzname, const timelib_tzdb *tzdb)
|
||||
timelib_tzinfo *php_date_parse_tzfile_wrapper(char *formal_tzname, const timelib_tzdb *tzdb, int *dummy_error_code)
|
||||
{
|
||||
return php_date_parse_tzfile(formal_tzname, tzdb);
|
||||
}
|
||||
@@ -1103,13 +1107,13 @@ static zend_string *date_format(char *format, size_t format_len, timelib_time *t
|
||||
if (localtime) {
|
||||
if (t->zone_type == TIMELIB_ZONETYPE_ABBR) {
|
||||
offset = timelib_time_offset_ctor();
|
||||
offset->offset = (t->z - (t->dst * 60)) * -60;
|
||||
offset->offset = (t->z + (t->dst * 3600));
|
||||
offset->leap_secs = 0;
|
||||
offset->is_dst = t->dst;
|
||||
offset->abbr = timelib_strdup(t->tz_abbr);
|
||||
} else if (t->zone_type == TIMELIB_ZONETYPE_OFFSET) {
|
||||
offset = timelib_time_offset_ctor();
|
||||
offset->offset = (t->z) * -60;
|
||||
offset->offset = (t->z);
|
||||
offset->leap_secs = 0;
|
||||
offset->is_dst = 0;
|
||||
offset->abbr = timelib_malloc(9); /* GMT±xxxx\0 */
|
||||
@@ -1174,8 +1178,8 @@ static zend_string *date_format(char *format, size_t format_len, timelib_time *t
|
||||
case 'H': length = slprintf(buffer, 32, "%02d", (int) t->h); break;
|
||||
case 'i': length = slprintf(buffer, 32, "%02d", (int) t->i); break;
|
||||
case 's': length = slprintf(buffer, 32, "%02d", (int) t->s); break;
|
||||
case 'u': length = slprintf(buffer, 32, "%06d", (int) floor(t->f * 1000000 + 0.5)); break;
|
||||
case 'v': length = slprintf(buffer, 32, "%03d", (int) floor(t->f * 1000 + 0.5)); break;
|
||||
case 'u': length = slprintf(buffer, 32, "%06d", (int) floor(t->us)); break;
|
||||
case 'v': length = slprintf(buffer, 32, "%03d", (int) floor(t->us / 1000)); break;
|
||||
|
||||
/* timezone */
|
||||
case 'I': length = slprintf(buffer, 32, "%d", localtime ? offset->is_dst : 0); break;
|
||||
@@ -1315,13 +1319,13 @@ PHPAPI int php_idate(char format, time_t ts, int localtime)
|
||||
if (!localtime) {
|
||||
if (t->zone_type == TIMELIB_ZONETYPE_ABBR) {
|
||||
offset = timelib_time_offset_ctor();
|
||||
offset->offset = (t->z - (t->dst * 60)) * -60;
|
||||
offset->offset = (t->z + (t->dst * 3600));
|
||||
offset->leap_secs = 0;
|
||||
offset->is_dst = t->dst;
|
||||
offset->abbr = timelib_strdup(t->tz_abbr);
|
||||
} else if (t->zone_type == TIMELIB_ZONETYPE_OFFSET) {
|
||||
offset = timelib_time_offset_ctor();
|
||||
offset->offset = (t->z - (t->dst * 60)) * -60;
|
||||
offset->offset = (t->z + (t->dst * 3600));
|
||||
offset->leap_secs = 0;
|
||||
offset->is_dst = t->dst;
|
||||
offset->abbr = timelib_malloc(9); /* GMT±xxxx\0 */
|
||||
@@ -1478,7 +1482,7 @@ PHP_FUNCTION(strtotime)
|
||||
{
|
||||
zend_string *times;
|
||||
int error1, error2;
|
||||
struct timelib_error_container *error;
|
||||
timelib_error_container *error;
|
||||
zend_long preset_ts = 0, ts;
|
||||
timelib_time *t, *now;
|
||||
timelib_tzinfo *tzi;
|
||||
@@ -1962,6 +1966,10 @@ static void date_period_it_rewind(zend_object_iterator *iter)
|
||||
if (iterator->object->current) {
|
||||
timelib_time_dtor(iterator->object->current);
|
||||
}
|
||||
if (!iterator->object->start) {
|
||||
zend_throw_error(NULL, "DatePeriod has not been initialized correctly");
|
||||
return;
|
||||
}
|
||||
iterator->object->current = timelib_time_clone(iterator->object->start);
|
||||
date_period_it_invalidate_current(iter);
|
||||
}
|
||||
@@ -2142,7 +2150,7 @@ static void date_register_classes(void) /* {{{ */
|
||||
date_object_handlers_interval.read_property = date_interval_read_property;
|
||||
date_object_handlers_interval.write_property = date_interval_write_property;
|
||||
date_object_handlers_interval.get_properties = date_object_get_properties_interval;
|
||||
date_object_handlers_interval.get_property_ptr_ptr = NULL;
|
||||
date_object_handlers_interval.get_property_ptr_ptr = date_interval_get_property_ptr_ptr;
|
||||
date_object_handlers_interval.get_gc = date_object_get_gc_interval;
|
||||
|
||||
INIT_CLASS_ENTRY(ce_period, "DatePeriod", date_funcs_period);
|
||||
@@ -2281,9 +2289,9 @@ static HashTable *date_object_get_properties(zval *object) /* {{{ */
|
||||
timelib_sll utc_offset = dateobj->time->z;
|
||||
|
||||
ZSTR_LEN(tmpstr) = snprintf(ZSTR_VAL(tmpstr), sizeof("+05:00"), "%c%02d:%02d",
|
||||
utc_offset > 0 ? '-' : '+',
|
||||
abs(utc_offset / 60),
|
||||
abs((utc_offset % 60)));
|
||||
utc_offset < 0 ? '-' : '+',
|
||||
php_date_llabs(utc_offset / 3600),
|
||||
php_date_llabs(((utc_offset % 3600) / 60)));
|
||||
|
||||
ZVAL_NEW_STR(&zv, tmpstr);
|
||||
}
|
||||
@@ -2373,9 +2381,9 @@ static HashTable *date_object_get_properties_timezone(zval *object) /* {{{ */
|
||||
zend_string *tmpstr = zend_string_alloc(sizeof("UTC+05:00")-1, 0);
|
||||
|
||||
ZSTR_LEN(tmpstr) = snprintf(ZSTR_VAL(tmpstr), sizeof("+05:00"), "%c%02d:%02d",
|
||||
tzobj->tzi.utc_offset > 0 ? '-' : '+',
|
||||
abs(tzobj->tzi.utc_offset / 60),
|
||||
abs((tzobj->tzi.utc_offset % 60)));
|
||||
tzobj->tzi.utc_offset < 0 ? '-' : '+',
|
||||
php_date_llabs(tzobj->tzi.utc_offset / 3600),
|
||||
php_date_llabs(((tzobj->tzi.utc_offset % 3600) / 60)));
|
||||
|
||||
ZVAL_NEW_STR(&zv, tmpstr);
|
||||
}
|
||||
@@ -2455,7 +2463,7 @@ static HashTable *date_object_get_properties_interval(zval *object) /* {{{ */
|
||||
PHP_DATE_INTERVAL_ADD_PROPERTY("h", h);
|
||||
PHP_DATE_INTERVAL_ADD_PROPERTY("i", i);
|
||||
PHP_DATE_INTERVAL_ADD_PROPERTY("s", s);
|
||||
ZVAL_DOUBLE(&zv, (double)intervalobj->diff->f);
|
||||
ZVAL_DOUBLE(&zv, (double)intervalobj->diff->us / 1000000.0);
|
||||
zend_hash_str_update(props, "f", sizeof("f") - 1, &zv);
|
||||
PHP_DATE_INTERVAL_ADD_PROPERTY("weekday", weekday);
|
||||
PHP_DATE_INTERVAL_ADD_PROPERTY("weekday_behavior", weekday_behavior);
|
||||
@@ -2591,7 +2599,7 @@ static void update_errors_warnings(timelib_error_container *last_errors) /* {{{
|
||||
|
||||
static void php_date_set_time_fraction(timelib_time *time, int microseconds)
|
||||
{
|
||||
time->f = (double) microseconds / 1000000;
|
||||
time->us = microseconds;
|
||||
}
|
||||
|
||||
static void php_date_get_current_time_with_fraction(time_t *sec, suseconds_t *usec)
|
||||
@@ -3010,7 +3018,7 @@ PHP_FUNCTION(date_get_last_errors)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
void php_date_do_return_parsed_time(INTERNAL_FUNCTION_PARAMETERS, timelib_time *parsed_time, struct timelib_error_container *error) /* {{{ */
|
||||
void php_date_do_return_parsed_time(INTERNAL_FUNCTION_PARAMETERS, timelib_time *parsed_time, timelib_error_container *error) /* {{{ */
|
||||
{
|
||||
zval element;
|
||||
|
||||
@@ -3028,10 +3036,10 @@ void php_date_do_return_parsed_time(INTERNAL_FUNCTION_PARAMETERS, timelib_time *
|
||||
PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(minute, i);
|
||||
PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(second, s);
|
||||
|
||||
if (parsed_time->f == -99999) {
|
||||
if (parsed_time->us == -99999) {
|
||||
add_assoc_bool(return_value, "fraction", 0);
|
||||
} else {
|
||||
add_assoc_double(return_value, "fraction", parsed_time->f);
|
||||
add_assoc_double(return_value, "fraction", (double)parsed_time->us / 1000000.0);
|
||||
}
|
||||
|
||||
zval_from_error_container(return_value, error);
|
||||
@@ -3090,7 +3098,7 @@ void php_date_do_return_parsed_time(INTERNAL_FUNCTION_PARAMETERS, timelib_time *
|
||||
PHP_FUNCTION(date_parse)
|
||||
{
|
||||
zend_string *date;
|
||||
struct timelib_error_container *error;
|
||||
timelib_error_container *error;
|
||||
timelib_time *parsed_time;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
@@ -3108,7 +3116,7 @@ PHP_FUNCTION(date_parse)
|
||||
PHP_FUNCTION(date_parse_from_format)
|
||||
{
|
||||
zend_string *date, *format;
|
||||
struct timelib_error_container *error;
|
||||
timelib_error_container *error;
|
||||
timelib_time *parsed_time;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(2, 2)
|
||||
@@ -3165,7 +3173,7 @@ static int php_date_modify(zval *object, char *modify, size_t modify_len) /* {{{
|
||||
return 0;
|
||||
}
|
||||
|
||||
memcpy(&dateobj->time->relative, &tmp_time->relative, sizeof(struct timelib_rel_time));
|
||||
memcpy(&dateobj->time->relative, &tmp_time->relative, sizeof(timelib_rel_time));
|
||||
dateobj->time->have_relative = tmp_time->have_relative;
|
||||
dateobj->time->sse_uptodate = 0;
|
||||
|
||||
@@ -3194,8 +3202,8 @@ static int php_date_modify(zval *object, char *modify, size_t modify_len) /* {{{
|
||||
}
|
||||
}
|
||||
|
||||
if (tmp_time->f != -99999) {
|
||||
dateobj->time->f = tmp_time->f;
|
||||
if (tmp_time->us != -99999) {
|
||||
dateobj->time->us = tmp_time->us;
|
||||
}
|
||||
|
||||
timelib_time_dtor(tmp_time);
|
||||
@@ -3484,10 +3492,10 @@ PHP_FUNCTION(date_offset_get)
|
||||
timelib_time_offset_dtor(offset);
|
||||
break;
|
||||
case TIMELIB_ZONETYPE_OFFSET:
|
||||
RETVAL_LONG(dateobj->time->z * -60);
|
||||
RETVAL_LONG(dateobj->time->z);
|
||||
break;
|
||||
case TIMELIB_ZONETYPE_ABBR:
|
||||
RETVAL_LONG((dateobj->time->z - (60 * dateobj->time->dst)) * -60);
|
||||
RETVAL_LONG((dateobj->time->z + (3600 * dateobj->time->dst)));
|
||||
break;
|
||||
}
|
||||
return;
|
||||
@@ -3506,7 +3514,7 @@ static void php_date_time_set(zval *object, zend_long h, zend_long i, zend_long
|
||||
dateobj->time->h = h;
|
||||
dateobj->time->i = i;
|
||||
dateobj->time->s = s;
|
||||
dateobj->time->f = ((double) ms) / 1000000;
|
||||
dateobj->time->us = ms;
|
||||
timelib_update_ts(dateobj->time, NULL);
|
||||
} /* }}} */
|
||||
|
||||
@@ -3903,9 +3911,9 @@ PHP_FUNCTION(timezone_name_get)
|
||||
timelib_sll utc_offset = tzobj->tzi.utc_offset;
|
||||
|
||||
ZSTR_LEN(tmpstr) = snprintf(ZSTR_VAL(tmpstr), sizeof("+05:00"), "%c%02d:%02d",
|
||||
utc_offset > 0 ? '-' : '+',
|
||||
abs(utc_offset / 60),
|
||||
abs((utc_offset % 60)));
|
||||
utc_offset < 0 ? '-' : '+',
|
||||
php_date_llabs(utc_offset / 3600),
|
||||
php_date_llabs(((utc_offset % 3600) / 60)));
|
||||
|
||||
RETURN_NEW_STR(tmpstr);
|
||||
}
|
||||
@@ -3969,10 +3977,10 @@ PHP_FUNCTION(timezone_offset_get)
|
||||
timelib_time_offset_dtor(offset);
|
||||
break;
|
||||
case TIMELIB_ZONETYPE_OFFSET:
|
||||
RETURN_LONG(tzobj->tzi.utc_offset * -60);
|
||||
RETURN_LONG(tzobj->tzi.utc_offset);
|
||||
break;
|
||||
case TIMELIB_ZONETYPE_ABBR:
|
||||
RETURN_LONG((tzobj->tzi.z.utc_offset - (tzobj->tzi.z.dst*60)) * -60);
|
||||
RETURN_LONG(tzobj->tzi.z.utc_offset + (tzobj->tzi.z.dst * 3600));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -4089,7 +4097,7 @@ static int date_interval_initialize(timelib_rel_time **rt, /*const*/ char *forma
|
||||
timelib_rel_time *p = NULL;
|
||||
int r = 0;
|
||||
int retval = 0;
|
||||
struct timelib_error_container *errors;
|
||||
timelib_error_container *errors;
|
||||
|
||||
timelib_strtointerval(format, format_length, &b, &e, &p, &r, &errors);
|
||||
|
||||
@@ -4158,7 +4166,7 @@ zval *date_interval_read_property(zval *object, zval *member, int type, void **c
|
||||
GET_VALUE_FROM_STRUCT(i, "i");
|
||||
GET_VALUE_FROM_STRUCT(s, "s");
|
||||
if (strcmp(Z_STRVAL_P(member), "f") == 0) {
|
||||
fvalue = obj->diff->f;
|
||||
fvalue = obj->diff->us / 1000000.0;
|
||||
break;
|
||||
}
|
||||
GET_VALUE_FROM_STRUCT(invert, "invert");
|
||||
@@ -4229,7 +4237,7 @@ void date_interval_write_property(zval *object, zval *member, zval *value, void
|
||||
SET_VALUE_FROM_STRUCT(i, "i");
|
||||
SET_VALUE_FROM_STRUCT(s, "s");
|
||||
if (strcmp(Z_STRVAL_P(member), "f") == 0) {
|
||||
obj->diff->f = zval_get_double(value);
|
||||
obj->diff->us = zval_get_double(value) * 1000000;
|
||||
break;
|
||||
}
|
||||
SET_VALUE_FROM_STRUCT(invert, "invert");
|
||||
@@ -4243,6 +4251,40 @@ void date_interval_write_property(zval *object, zval *member, zval *value, void
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ date_interval_get_property_ptr_ptr */
|
||||
static zval *date_interval_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot)
|
||||
{
|
||||
zval tmp_member, *ret;
|
||||
|
||||
if (Z_TYPE_P(member) != IS_STRING) {
|
||||
tmp_member = *member;
|
||||
zval_copy_ctor(&tmp_member);
|
||||
convert_to_string(&tmp_member);
|
||||
member = &tmp_member;
|
||||
cache_slot = NULL;
|
||||
}
|
||||
|
||||
if(zend_binary_strcmp("y", sizeof("y") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 ||
|
||||
zend_binary_strcmp("m", sizeof("m") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 ||
|
||||
zend_binary_strcmp("d", sizeof("d") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 ||
|
||||
zend_binary_strcmp("h", sizeof("h") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 ||
|
||||
zend_binary_strcmp("i", sizeof("i") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 ||
|
||||
zend_binary_strcmp("s", sizeof("s") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 ||
|
||||
zend_binary_strcmp("days", sizeof("days") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 ||
|
||||
zend_binary_strcmp("invert", sizeof("invert") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0) {
|
||||
/* Fallback to read_property. */
|
||||
ret = NULL;
|
||||
} else {
|
||||
ret = (zend_get_std_object_handlers())->get_property_ptr_ptr(object, member, type, cache_slot);
|
||||
}
|
||||
|
||||
if (member == &tmp_member) {
|
||||
zval_dtor(member);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto DateInterval::__construct([string interval_spec])
|
||||
Creates new DateInterval object.
|
||||
@@ -4311,7 +4353,14 @@ static int php_date_interval_initialize_from_hash(zval **return_value, php_inter
|
||||
PHP_DATE_INTERVAL_READ_PROPERTY("h", h, timelib_sll, -1)
|
||||
PHP_DATE_INTERVAL_READ_PROPERTY("i", i, timelib_sll, -1)
|
||||
PHP_DATE_INTERVAL_READ_PROPERTY("s", s, timelib_sll, -1)
|
||||
PHP_DATE_INTERVAL_READ_PROPERTY_DOUBLE("f", f, -1)
|
||||
do {
|
||||
zval *z_arg = zend_hash_str_find(myht, "f", sizeof("f") - 1);
|
||||
if (z_arg) {
|
||||
(*intobj)->diff->us = ((double)zval_get_double(z_arg) * 1000000);
|
||||
} else {
|
||||
(*intobj)->diff->us = (double) -1000000;
|
||||
}
|
||||
} while (0);
|
||||
PHP_DATE_INTERVAL_READ_PROPERTY("weekday", weekday, int, -1)
|
||||
PHP_DATE_INTERVAL_READ_PROPERTY("weekday_behavior", weekday_behavior, int, -1)
|
||||
PHP_DATE_INTERVAL_READ_PROPERTY("first_last_day_of", first_last_day_of, int, -1)
|
||||
@@ -4420,8 +4469,8 @@ static zend_string *date_interval_format(char *format, size_t format_len, timeli
|
||||
case 'S': length = slprintf(buffer, 32, "%02" ZEND_LONG_FMT_SPEC, (zend_long) t->s); break;
|
||||
case 's': length = slprintf(buffer, 32, ZEND_LONG_FMT, (zend_long) t->s); break;
|
||||
|
||||
case 'F': length = slprintf(buffer, 32, "%06" ZEND_LONG_FMT_SPEC, (zend_long) (t->f * 1000000)); break;
|
||||
case 'f': length = slprintf(buffer, 32, ZEND_LONG_FMT, (zend_long) (t->f * 1000000)); break;
|
||||
case 'F': length = slprintf(buffer, 32, "%06" ZEND_LONG_FMT_SPEC, (zend_long) t->us); break;
|
||||
case 'f': length = slprintf(buffer, 32, ZEND_LONG_FMT, (zend_long) t->us); break;
|
||||
|
||||
case 'a': {
|
||||
if ((int) t->days != -99999) {
|
||||
@@ -4483,7 +4532,7 @@ static int date_period_initialize(timelib_time **st, timelib_time **et, timelib_
|
||||
timelib_rel_time *p = NULL;
|
||||
int r = 0;
|
||||
int retval = 0;
|
||||
struct timelib_error_container *errors;
|
||||
timelib_error_container *errors;
|
||||
|
||||
timelib_strtointerval(format, format_length, &b, &e, &p, &r, &errors);
|
||||
|
||||
@@ -4709,8 +4758,7 @@ PHP_FUNCTION(timezone_identifiers_list)
|
||||
}
|
||||
|
||||
tzdb = DATE_TIMEZONEDB;
|
||||
item_count = tzdb->index_size;
|
||||
table = tzdb->index;
|
||||
table = timelib_timezone_identifiers_list((timelib_tzdb*) tzdb, &item_count);
|
||||
|
||||
array_init(return_value);
|
||||
|
||||
|
||||
@@ -52,13 +52,6 @@ Array
|
||||
[comments] => %s
|
||||
)
|
||||
Array
|
||||
(
|
||||
[country_code] => %s
|
||||
[latitude] => %f
|
||||
[longitude] => %f
|
||||
[comments] =>
|
||||
)
|
||||
Array
|
||||
(
|
||||
[country_code] => %s
|
||||
[latitude] => %f
|
||||
|
||||
@@ -29,22 +29,22 @@ string(5) "array"
|
||||
int(%d)
|
||||
|
||||
-- Format a sample entry --
|
||||
array(17) {
|
||||
array(12) {
|
||||
[0]=>
|
||||
array(3) {
|
||||
["dst"]=>
|
||||
bool(true)
|
||||
bool(false)
|
||||
["offset"]=>
|
||||
int(-14400)
|
||||
int(32400)
|
||||
["timezone_id"]=>
|
||||
string(18) "America/Porto_Acre"
|
||||
string(18) "Australia/Adelaide"
|
||||
}
|
||||
[1]=>
|
||||
array(3) {
|
||||
["dst"]=>
|
||||
bool(false)
|
||||
["offset"]=>
|
||||
int(32400)
|
||||
int(34200)
|
||||
["timezone_id"]=>
|
||||
string(18) "Australia/Adelaide"
|
||||
}
|
||||
@@ -53,36 +53,36 @@ array(17) {
|
||||
["dst"]=>
|
||||
bool(false)
|
||||
["offset"]=>
|
||||
int(34200)
|
||||
int(32400)
|
||||
["timezone_id"]=>
|
||||
string(18) "Australia/Adelaide"
|
||||
string(21) "Australia/Broken_Hill"
|
||||
}
|
||||
[3]=>
|
||||
array(3) {
|
||||
["dst"]=>
|
||||
bool(true)
|
||||
bool(false)
|
||||
["offset"]=>
|
||||
int(-14400)
|
||||
int(32400)
|
||||
["timezone_id"]=>
|
||||
string(16) "America/Eirunepe"
|
||||
string(16) "Australia/Darwin"
|
||||
}
|
||||
[4]=>
|
||||
array(3) {
|
||||
["dst"]=>
|
||||
bool(true)
|
||||
bool(false)
|
||||
["offset"]=>
|
||||
int(-14400)
|
||||
int(32400)
|
||||
["timezone_id"]=>
|
||||
string(18) "America/Rio_Branco"
|
||||
string(15) "Australia/North"
|
||||
}
|
||||
[5]=>
|
||||
array(3) {
|
||||
["dst"]=>
|
||||
bool(true)
|
||||
bool(false)
|
||||
["offset"]=>
|
||||
int(-14400)
|
||||
int(32400)
|
||||
["timezone_id"]=>
|
||||
string(11) "Brazil/Acre"
|
||||
string(15) "Australia/South"
|
||||
}
|
||||
[6]=>
|
||||
array(3) {
|
||||
@@ -91,81 +91,36 @@ array(17) {
|
||||
["offset"]=>
|
||||
int(32400)
|
||||
["timezone_id"]=>
|
||||
string(21) "Australia/Broken_Hill"
|
||||
string(20) "Australia/Yancowinna"
|
||||
}
|
||||
[7]=>
|
||||
array(3) {
|
||||
["dst"]=>
|
||||
bool(false)
|
||||
["offset"]=>
|
||||
int(32400)
|
||||
int(34200)
|
||||
["timezone_id"]=>
|
||||
string(16) "Australia/Darwin"
|
||||
string(21) "Australia/Broken_Hill"
|
||||
}
|
||||
[8]=>
|
||||
array(3) {
|
||||
["dst"]=>
|
||||
bool(false)
|
||||
["offset"]=>
|
||||
int(32400)
|
||||
int(34200)
|
||||
["timezone_id"]=>
|
||||
string(15) "Australia/North"
|
||||
string(16) "Australia/Darwin"
|
||||
}
|
||||
[9]=>
|
||||
array(3) {
|
||||
["dst"]=>
|
||||
bool(false)
|
||||
["offset"]=>
|
||||
int(32400)
|
||||
int(34200)
|
||||
["timezone_id"]=>
|
||||
string(15) "Australia/South"
|
||||
string(15) "Australia/North"
|
||||
}
|
||||
[10]=>
|
||||
array(3) {
|
||||
["dst"]=>
|
||||
bool(false)
|
||||
["offset"]=>
|
||||
int(32400)
|
||||
["timezone_id"]=>
|
||||
string(20) "Australia/Yancowinna"
|
||||
}
|
||||
[11]=>
|
||||
array(3) {
|
||||
["dst"]=>
|
||||
bool(false)
|
||||
["offset"]=>
|
||||
int(34200)
|
||||
["timezone_id"]=>
|
||||
string(13) "Asia/Jayapura"
|
||||
}
|
||||
[12]=>
|
||||
array(3) {
|
||||
["dst"]=>
|
||||
bool(false)
|
||||
["offset"]=>
|
||||
int(34200)
|
||||
["timezone_id"]=>
|
||||
string(21) "Australia/Broken_Hill"
|
||||
}
|
||||
[13]=>
|
||||
array(3) {
|
||||
["dst"]=>
|
||||
bool(false)
|
||||
["offset"]=>
|
||||
int(34200)
|
||||
["timezone_id"]=>
|
||||
string(16) "Australia/Darwin"
|
||||
}
|
||||
[14]=>
|
||||
array(3) {
|
||||
["dst"]=>
|
||||
bool(false)
|
||||
["offset"]=>
|
||||
int(34200)
|
||||
["timezone_id"]=>
|
||||
string(15) "Australia/North"
|
||||
}
|
||||
[15]=>
|
||||
array(3) {
|
||||
["dst"]=>
|
||||
bool(false)
|
||||
@@ -174,7 +129,7 @@ array(17) {
|
||||
["timezone_id"]=>
|
||||
string(15) "Australia/South"
|
||||
}
|
||||
[16]=>
|
||||
[11]=>
|
||||
array(3) {
|
||||
["dst"]=>
|
||||
bool(false)
|
||||
|
||||
@@ -42,7 +42,7 @@ array(16) {
|
||||
["zone_type"]=>
|
||||
int(2)
|
||||
["zone"]=>
|
||||
int(-60)
|
||||
int(3600)
|
||||
["is_dst"]=>
|
||||
bool(false)
|
||||
["tz_abbr"]=>
|
||||
|
||||
@@ -40,20 +40,20 @@ echo "\n";
|
||||
NULL
|
||||
NULL
|
||||
|
||||
int(-60)
|
||||
int(3600)
|
||||
string(1) "A"
|
||||
|
||||
int(-60)
|
||||
int(3600)
|
||||
string(1) "A"
|
||||
|
||||
int(-60)
|
||||
int(3600)
|
||||
string(1) "A"
|
||||
|
||||
int(-60)
|
||||
int(3600)
|
||||
string(1) "A"
|
||||
|
||||
int(-60)
|
||||
int(3600)
|
||||
string(1) "A"
|
||||
|
||||
int(-60)
|
||||
int(3600)
|
||||
string(1) "A"
|
||||
@@ -5,7 +5,7 @@ date.timezone=Asia/Singapore
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
print strtotime('2008-05-23 00:00:00 SGT');
|
||||
print strtotime('2008-05-23 00:00:00 +08');
|
||||
print "\n";
|
||||
print strtotime('2008-05-23 00:00:00');
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ object(DateInterval)#%d (16) {
|
||||
["special_amount"]=>
|
||||
int(-1)
|
||||
["have_weekday_relative"]=>
|
||||
int(9)
|
||||
int(%d)
|
||||
["have_special_relative"]=>
|
||||
int(0)
|
||||
["f"]=>
|
||||
|
||||
@@ -7,10 +7,10 @@ date_default_timezone_set('UTC');
|
||||
$earlyDate1 = DateTime::createFromFormat('U.u', '1.8642')->modify('-5 seconds');
|
||||
$earlyDate2 = DateTime::createFromFormat('U.u', '1.2768')->modify('-5 seconds');
|
||||
$earlyDate3 = DateTime::createFromFormat('U.u', '1.2768')->modify('-5 seconds');
|
||||
|
||||
// var_dump($earlyDate1, $earlyDate2, $earlyDate3);
|
||||
var_dump($earlyDate1 == $earlyDate2);
|
||||
var_dump($earlyDate1 < $earlyDate2);
|
||||
var_dump($earlyDate2 > $earlyDate1);
|
||||
var_dump($earlyDate1 > $earlyDate2);
|
||||
var_dump($earlyDate2 < $earlyDate1);
|
||||
var_dump($earlyDate2 == $earlyDate3);
|
||||
--EXPECT--
|
||||
bool(false)
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
--TEST--
|
||||
Bug #75002 Null Pointer Dereference in timelib_time_clone
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class aaa extends DatePeriod {
|
||||
public function __construct() { }
|
||||
}
|
||||
|
||||
$start=new DateTime( '2012-08-01' );
|
||||
|
||||
foreach (new aaa($start) as $y) {
|
||||
$a=$key;
|
||||
}
|
||||
|
||||
?>
|
||||
==DONE==
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught Error: DatePeriod has not been initialized correctly in %sbug75002.php:%d
|
||||
Stack trace:
|
||||
#0 {main}
|
||||
thrown in %sbug75002.php on line %d
|
||||
@@ -0,0 +1,17 @@
|
||||
--TEST--
|
||||
Bug #75222 DateInterval microseconds property always 0
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$dt1 = new \DateTimeImmutable('2017-01-01T00:00:00.000000Z');
|
||||
$dt2 = new \DateTimeImmutable('2017-01-01T00:00:00.123456Z');
|
||||
$diff = $dt1->diff($dt2);
|
||||
//var_dump($diff);
|
||||
var_dump($diff->f);
|
||||
var_dump(get_object_vars($diff)['f']);
|
||||
var_dump($diff->f === get_object_vars($diff)['f']);
|
||||
?>
|
||||
--EXPECTF--
|
||||
float(0.123456)
|
||||
float(0.123456)
|
||||
bool(true)
|
||||
@@ -0,0 +1,16 @@
|
||||
--TEST--
|
||||
Test DateInterval props with dimension handling
|
||||
--FILE--
|
||||
<?php
|
||||
class Z extends DateInterval{}
|
||||
$z = new Z('P2Y4DT6H8M');
|
||||
$i = 0;
|
||||
$z->prop[1]=10;
|
||||
while ($i < 1026) {
|
||||
$z->prop[$i] = $i;
|
||||
$i++;
|
||||
}
|
||||
?>
|
||||
==NOCRASH==
|
||||
--EXPECT--
|
||||
==NOCRASH==
|
||||
@@ -104,7 +104,7 @@ array(15) {
|
||||
["zone_type"]=>
|
||||
int(1)
|
||||
["zone"]=>
|
||||
int(720)
|
||||
int(-43200)
|
||||
["is_dst"]=>
|
||||
bool(false)
|
||||
}
|
||||
@@ -228,7 +228,7 @@ array(15) {
|
||||
["zone_type"]=>
|
||||
int(1)
|
||||
["zone"]=>
|
||||
int(180)
|
||||
int(-10800)
|
||||
["is_dst"]=>
|
||||
bool(false)
|
||||
}
|
||||
|
||||
@@ -10,22 +10,22 @@ echo "Done\n";
|
||||
--EXPECTF--
|
||||
array(9) {
|
||||
["sunrise"]=>
|
||||
int(1165897782)
|
||||
int(1165897761)
|
||||
["sunset"]=>
|
||||
int(1165934168)
|
||||
int(1165934160)
|
||||
["transit"]=>
|
||||
int(1165915975)
|
||||
int(1165915961)
|
||||
["civil_twilight_begin"]=>
|
||||
int(1165896176)
|
||||
int(1165896156)
|
||||
["civil_twilight_end"]=>
|
||||
int(1165935773)
|
||||
int(1165935765)
|
||||
["nautical_twilight_begin"]=>
|
||||
int(1165894353)
|
||||
int(1165894334)
|
||||
["nautical_twilight_end"]=>
|
||||
int(1165937597)
|
||||
int(1165937588)
|
||||
["astronomical_twilight_begin"]=>
|
||||
int(1165892570)
|
||||
int(1165892551)
|
||||
["astronomical_twilight_end"]=>
|
||||
int(1165939380)
|
||||
int(1165939371)
|
||||
}
|
||||
Done
|
||||
@@ -11,13 +11,13 @@ foreach ($sun_info as $key => $elem )
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
2007-04-13 06:12:19 CEST sunrise
|
||||
2007-04-13 20:31:50 CEST sunset
|
||||
2007-04-13 13:22:05 CEST transit
|
||||
2007-04-13 05:28:03 CEST civil_twilight_begin
|
||||
2007-04-13 21:16:06 CEST civil_twilight_end
|
||||
2007-04-13 04:30:08 CEST nautical_twilight_begin
|
||||
2007-04-13 22:14:01 CEST nautical_twilight_end
|
||||
2007-04-13 03:14:36 CEST astronomical_twilight_begin
|
||||
2007-04-13 23:29:33 CEST astronomical_twilight_end
|
||||
2007-04-13 06:13:31 CEST sunrise
|
||||
2007-04-13 20:30:51 CEST sunset
|
||||
2007-04-13 13:22:11 CEST transit
|
||||
2007-04-13 05:29:22 CEST civil_twilight_begin
|
||||
2007-04-13 21:15:00 CEST civil_twilight_end
|
||||
2007-04-13 04:31:43 CEST nautical_twilight_begin
|
||||
2007-04-13 22:12:39 CEST nautical_twilight_end
|
||||
2007-04-13 03:17:01 CEST astronomical_twilight_begin
|
||||
2007-04-13 23:27:21 CEST astronomical_twilight_end
|
||||
Done
|
||||
@@ -22,7 +22,7 @@ echo "Done\n";
|
||||
--EXPECTF--
|
||||
sunrise: 21:00:00
|
||||
sunset: 21:00:00
|
||||
transit: 10:04:02
|
||||
transit: 10:03:48
|
||||
civil_twilight_begin: 21:00:00
|
||||
civil_twilight_end: 21:00:00
|
||||
nautical_twilight_begin: 21:00:00
|
||||
@@ -32,11 +32,11 @@ astronomical_twilight_end: 21:00:00
|
||||
|
||||
sunrise: 21:00:01
|
||||
sunset: 21:00:01
|
||||
transit: 08:52:30
|
||||
transit: 08:52:44
|
||||
civil_twilight_begin: 21:00:01
|
||||
civil_twilight_end: 21:00:01
|
||||
nautical_twilight_begin: 21:00:01
|
||||
nautical_twilight_end: 21:00:01
|
||||
astronomical_twilight_begin: 21:00:01
|
||||
astronomical_twilight_end: 21:00:01
|
||||
Done
|
||||
Done
|
||||
Loaded 100 of 428 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user