Anyone knows how to get the “Total time since the software was initialized (in seconds).” without using wait()?
Here’s example code:
local _, time = wait(0.1)
print("Total time since the software was intialized: " .. time)
Anyone knows how to get the “Total time since the software was initialized (in seconds).” without using wait()?
Here’s example code:
local _, time = wait(0.1)
print("Total time since the software was intialized: " .. time)
time()
does this if I recall correctly.
Link to docs to support this:
time()
is the time since the Server Started running
So when you create a New Server in a game, or run a test in Studio, this Global will start running based off of that. It can be useful for many things, but people would use os.time()
or tick()
for a purpose that time()
can fill.
So no, I doesnt do this according to these people above.
The Second Thing wait()
returns the exact time since your device started running (aka was turned on)
local a,b = wait() -- grabs data using 2 Arguments
print(a) -- Time yielded.
print(b) -- Time since Device was Initialized
So yeah, it does return that.
So. as far as I’m concerned, os.clock()
would be similar except its more precise than wait()
, which wait()
would now be considered deprecated.
07:33:18.864 > local _,a = wait() print(os.clock(), a) - Studio
1693.7461008 -- os.clock()
1664.9538787233178 -- wait()
-- Can vary as wait() throttles and is slower than newer methods
Actually, os.clock() prints your device’s CPU uptime.
Oof, that makes sense, I thought it said, when the Device first turned on, not when the software was opened.
elapsedTime()
should be exactly the same, but it’s deprecated. time()
should work as a replacement.
It is indeed “elapsedTime()”.
But if it’s getting deprecated why doesn’t it have an identical replacement?
time() only prints how much time elapsed since the game was ran.
Of course. Getting deprecated by “os.clock()”.
Which returns a way different value.
If any Roblox engineer is reading this, maybe you should undeprecate elapsedTime()???
there is always a reason stuff is deprecated, They dont just deprecate things for no reason.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.