小编The*_*ise的帖子

PHP hrtime() 的一致性如何?

我目前正在hrtime()我的一个项目中使用聊天系统(仍处于开发阶段)。

在发送的每条消息中,我将hrtime(true)值与消息一起存储到数据库中。

因此,收件人将根据应用程序 localStorage 中存储的最后一条消息的时间请求新消息。例如: select*from messages_table where message_hrtime>$last_hrtime and message_to=$me

直到今天它一直工作正常,我注意到插入数据库的新消息 hrtime(true)值减少了,这使得新消息无法被接收。

请注意,message_hrtime 列从 id 35 开始减少

请注意,列 message_hrtime 在 id 35 上减少

根据这篇文章 https://thephp.cc/articles/high-resolution-monotonic-timer, hrtime() 不断增加。

现在很困惑是否hrtime(true)一致。

PHP 7.3

php

5
推荐指数
1
解决办法
1834
查看次数

标签 统计

php ×1