@@ -93,6 +93,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
93
93
#endif
94
94
95
95
#include <Zend/zend_portability.h>
96
+ #include <Zend/zend_time.h>
96
97
97
98
struct lsapi_MD5Context {
98
99
uint32 buf [4 ];
@@ -246,15 +247,15 @@ void LSAPI_Log(int flag, const char * fmt, ...)
246
247
if ((flag & LSAPI_LOG_TIMESTAMP_BITS )
247
248
&& !(s_stderr_is_pipe ))
248
249
{
249
- struct timeval tv ;
250
+ struct timespec ts ;
250
251
struct tm tm ;
251
- gettimeofday ( & tv , NULL );
252
- localtime_r (& tv .tv_sec , & tm );
252
+ zend_realtime_spec ( & ts );
253
+ localtime_r (& ts .tv_sec , & tm );
253
254
if (flag & LSAPI_LOG_TIMESTAMP_FULL )
254
255
{
255
- p += snprintf (p , 1024 , "%04d-%02d-%02d %02d:%02d:%02d.%06d " ,
256
+ p += snprintf (p , 1024 , "%04d-%02d-%02d %02d:%02d:%02d.%09ld " ,
256
257
tm .tm_year + 1900 , tm .tm_mon + 1 , tm .tm_mday ,
257
- tm .tm_hour , tm .tm_min , tm .tm_sec , ( int ) tv . tv_usec );
258
+ tm .tm_hour , tm .tm_min , tm .tm_sec , ts . tv_nsec );
258
259
}
259
260
else if (flag & LSAPI_LOG_TIMESTAMP_HMS )
260
261
{
0 commit comments