开发者

PHP - get Time independent of the system it is running on

开发者 https://www.devze.com 2023-03-17 16:04 出处:网络
I\'m using PHP and need to do som开发者_开发百科e time based actions. I have 2 servers set up on two different machines. However both system clocks are different. I ended up setting both clocks to sam

I'm using PHP and need to do som开发者_开发百科e time based actions. I have 2 servers set up on two different machines. However both system clocks are different. I ended up setting both clocks to same time, a trivial task but Is there a PHP method which returns the time independent of the system clock?

Thanks in advance.


As far as PHP (and OS) is concerned, system time is the time. There is no other "independent" time the computer knows about. If you really do not trust the clock of your own system, you might want to fetch it across the network from some other machine. NTP synchronization daemon will do it for you on OS level, by the way.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号