你如何获得“当前系统时间”?

时间:2022-03-11 03:36:36

The documentation of SKScene -update is as follows: 你如何获得“当前系统时间”?

SKScene -update的文档如下:

What exactly is "the current system time," and how can I get it other than via SKScene -update?

究竟什么是“当前的系统时间”,除了通过SKScene -update之外我怎么才能得到它?

I've tried CFAbsoluteTimeGetCurrent(), but apparently that

我已经尝试过CFAbsoluteTimeGetCurrent(),但显然是这样

Returns the current system absolute time[, which is] is measured in seconds relative to the absolute reference date of Jan 1 2001 00:00:00 GMT.

返回当前系统绝对时间[,它是]相对于2001年1月1日00:00:00 GMT的绝对参考日期以秒为单位。

and is not the same thing as "the current system time," which, according to my tests, has a value that is several orders of magnitude less than the "current absolute time."

并且与“当前系统时间”不同,根据我的测试,它的值比“当前绝对时间”小几个数量级。

1 个解决方案

#1


1  

assign the currentTime from update: to an ivar then you have it available anywhere for the current frame. Note that while time passes on while the frame is being processed you should only work with the current frame's reference time passed into update: throughout the frame.

将currentTime从update:分配给ivar然后你可以在当前帧的任何地方使用它。请注意,虽然在处理帧时时间过去,但您应该只使用当前帧传递到更新的参考时间:整个帧。

#1


1  

assign the currentTime from update: to an ivar then you have it available anywhere for the current frame. Note that while time passes on while the frame is being processed you should only work with the current frame's reference time passed into update: throughout the frame.

将currentTime从update:分配给ivar然后你可以在当前帧的任何地方使用它。请注意,虽然在处理帧时时间过去,但您应该只使用当前帧传递到更新的参考时间:整个帧。