Discuss Scratch

frodewin
Scratcher
500+ posts

Timestamp (something like number of seconds since 00:00:00 UTC on 1 January 1970)

I need to calculate a timestamp which allows to order events from players independently of their time zone.

I tried something like

(((current_day)*24+current_hour)*60+current_minute)*60+current_second

but the problem is that due to different timezones, the current hour does not evaluate the same, which gives me different time stamps for the same instant. I would be glad for any suggestions to solve this problem.

Last edited by frodewin (Feb. 9, 2014 17:16:51)




You can also find my best projects here or stop at my profile and say hi!
1234abcdcba4321
Scratcher
1000+ posts

Timestamp (something like number of seconds since 00:00:00 UTC on 1 January 1970)

You need a cloud variable so you can have a global time.
Then, you need a server to constantly update the cloud var.
Then, you should know what to do from there

I'd highly appreciate it if you were to follow me. Don't forget to go to my profile.
All of my programming suggestions <— You should really get the suggestions move back to the suggestions forum!
Five hundred posts! I never expected to get up there… In only 2-3 months.
Does anyone know what a signature is? I mean, I've already seen 6-7 people get confused.
frodewin
Scratcher
500+ posts

Timestamp (something like number of seconds since 00:00:00 UTC on 1 January 1970)

1234abcdcba4321 wrote:

You need a cloud variable so you can have a global time.
Then, you need a server to constantly update the cloud var.
Then, you should know what to do from there

Thanks a lot! I was afraid I need to do this with a cloud time server.



You can also find my best projects here or stop at my profile and say hi!

Powered by DjangoBB