[php-src] PR #15474: Remove unnecessary Windows specific time formatting

From: Date: Sat, 17 Aug 2024 19:49:38 +0000
Subject: [php-src] PR #15474: Remove unnecessary Windows specific time formatting
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-28038@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/15474 Author: cmb69 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.

« previous php.git-pulls (#28038) next »