DasKairo
(Cairo)
December 26, 2022, 1:03am
#1
How would I use time()
and tick()?
time() -- What does it do?
tick() -- Also this
Appearently time
“measures” time.
time
is the number of seconds since the game started running. tick
is the number of seconds since the UNIX epoch.
2 Likes
DasKairo
(Cairo)
December 26, 2022, 1:06am
#3
This is the Part I’m a bit confused about
Unix time[a] is a date and time representation widely used in computing. It measures time by the number of seconds that have elapsed since 00:00:00 UTC on 1 January 1970, the beginning of the Unix epoch, less adjustments made due to leap seconds.
Unix time originated as the system time of Unix operating systems. It has come to be widely used in other computer operating systems, file systems, programming languages, and databases.
Two layers of encoding make up Unix time. The first layer encodes...
It’s the number of seconds since 00:00 January 1, 1970 in UTC.
1 Like
DasKairo
(Cairo)
December 26, 2022, 1:08am
#5
wouldn’t you just use os.time()
for this? It does the same thing as tick
after testing
os.time
is based off of UTC time, and tick
is based off the timezone of the machine running it. So if you wanted to make a clock to display to the client, you would use tick
.
DasKairo
(Cairo)
December 26, 2022, 1:13am
#7
Ok, now I’m getting a Little confused
DasKairo
(Cairo)
December 26, 2022, 1:17am
#8
I guess that will work, but how will I use time
in games?
Operatik
(Operatik)
December 26, 2022, 10:31am
#9
Precision of time()
is whole seconds and only useful when you want to see server age… although you should be careful of what you choose based on a specific benchmarking:
Ok. This system clock is confusing me, so I want to clarify some things. For context, I use tick() for everything right now, including computing spring deltas for updating a UI element.
Is this grid accurate?
[image]
The implication is I should use os.clock() or time() for EVERYTHING, unless I want stuff to synchronize with the game time. I’m ok with clocks running backwards if my clock doesn’t lag, although maybe that can create stutter?
Can you tell me if:
time() lags if simulation lags
…
system
(system)
Closed
January 9, 2023, 10:31am
#10
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.