Commit 4a77ce2
authored
Remove unnecessary Windows specific time formatting (GH-15474)
`gettimeofday()` is supported by PHP on Windows for ages; and generally
`localtime()` is supported on Windows for a long time. As such, there
is no need for the Windows specific formatting code.
However, the general Windows caveat regarding `time_t` applies, namely
that it is usually `__time64_t`, unless `_USE_32BIT_TIME_T` is declared,
what we do for 32bit architectures, in which case it is `__time32_t`.
Now, `struct timeval` is imported from WinSock2.h, where the members are
declared as long (i.e. 32bit on both x86 and x64). That means passing
a pointer to `tv_sec` to `localtime()` likely fails on x64, or at least
doesn't yield the desired result. Therefore, we assign `tv_sec` to an
appropriate `time_t` variable, and also make sure that the `time_buffer`
is zero-terminated even if the `localtime()` call still fails.1 parent f16cb18 commit 4a77ce2
1 file changed
+8
-28
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | 79 | | |
92 | 80 | | |
93 | 81 | | |
94 | | - | |
| 82 | + | |
| 83 | + | |
95 | 84 | | |
96 | 85 | | |
97 | 86 | | |
98 | 87 | | |
99 | 88 | | |
100 | 89 | | |
101 | 90 | | |
| 91 | + | |
| 92 | + | |
102 | 93 | | |
103 | 94 | | |
104 | | - | |
105 | 95 | | |
106 | 96 | | |
107 | 97 | | |
| |||
173 | 163 | | |
174 | 164 | | |
175 | 165 | | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | 166 | | |
189 | 167 | | |
190 | 168 | | |
191 | | - | |
| 169 | + | |
| 170 | + | |
192 | 171 | | |
193 | 172 | | |
194 | 173 | | |
195 | 174 | | |
196 | 175 | | |
197 | 176 | | |
198 | 177 | | |
| 178 | + | |
| 179 | + | |
199 | 180 | | |
200 | 181 | | |
201 | | - | |
202 | 182 | | |
203 | 183 | | |
204 | 184 | | |
| |||
0 commit comments