Skip to content

Commit b08662a

Browse files
committed
sapi/litespeed
1 parent ccae59a commit b08662a

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

sapi/litespeed/lsapilib.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
9393
#endif
9494

9595
#include <Zend/zend_portability.h>
96+
#include <Zend/zend_time.h>
9697

9798
struct lsapi_MD5Context {
9899
uint32 buf[4];
@@ -246,15 +247,15 @@ void LSAPI_Log(int flag, const char * fmt, ...)
246247
if ((flag & LSAPI_LOG_TIMESTAMP_BITS)
247248
&& !(s_stderr_is_pipe))
248249
{
249-
struct timeval tv;
250+
struct timespec ts;
250251
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);
253254
if (flag & LSAPI_LOG_TIMESTAMP_FULL)
254255
{
255-
p += snprintf(p, 1024, "%04d-%02d-%02d %02d:%02d:%02d.%06d ",
256+
p += snprintf(p, 1024, "%04d-%02d-%02d %02d:%02d:%02d.%09ld ",
256257
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);
258259
}
259260
else if (flag & LSAPI_LOG_TIMESTAMP_HMS)
260261
{

0 commit comments

Comments
 (0)