How do I convert wallclocktime value to milliseconds

Get help using Construct 2

Post » Sun Nov 15, 2015 10:04 am

Hi

I need to convert the wallclocktime value to milliseconds to submit to leaderboard as required.

Leaderboard score specification:

Time leaderboards present scores in hours / minutes / seconds / hundredths of a second format. You must submit scores as milliseconds, so 66032 would be interpreted as 1:06.03.

I tried simply multiply the value by 1000 but not worked.

I'm using this: floor(wallclocktime_var*1000).

Thanks in advance for any help.
Last edited by RBuster on Tue Nov 17, 2015 12:37 pm, edited 1 time in total.
B
74
S
13
G
4
Posts: 1,000
Reputation: 8,041

Post » Sun Nov 15, 2015 3:58 pm

Convert each part into milliseconds. Your example:
1 minute -> 1x60 seconds -> 1x60x1000 milliseconds = 60000
6 seconds -> 6x1000 milliseconds = 6000
3/100 seconds -> 3*(1000/100) = 3*10 milliseconds = 30

60000 + 6000 + 30 = 66030 milliseconds

(I'm guessing 66032 came from doing the calculation as floating point so some round error creeped in).
ImageImageImage
B
71
S
21
G
231
Posts: 3,691
Reputation: 129,358

Post » Tue Nov 17, 2015 12:37 pm

Thanks @blackhornet
B
74
S
13
G
4
Posts: 1,000
Reputation: 8,041


Return to How do I....?

Who is online

Users browsing this forum: Lordshiva1948 and 68 guests