Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   New Scripting Engine (GS2) (https://forums.graalonline.com/forums/forumdisplay.php?f=153)
-   -   Getting a player's local time (https://forums.graalonline.com/forums/showthread.php?t=80140)

Stryke 06-19-2008 02:41 AM

Getting a player's local time
 
Like their timezone, date AM/PM. How do you get this ?

cbk1994 06-19-2008 03:48 AM

Quote:

Originally Posted by Stryke (Post 1397983)
Like their timezone, date AM/PM. How do you get this ?

Ask them.

Look in the code gallery, Hell Raven made a function to get the time using timevar2 serverside ... you would have to adjust that clientside to get the time.

Chompy 06-19-2008 12:19 PM

What do you need it for though?

Skyld 06-19-2008 12:46 PM

Quote:

Originally Posted by Stryke (Post 1397983)
Like their timezone, date AM/PM. How do you get this ?

On Mac and Linux versions of Graal, timevar2 reveals the UNIX time (seconds since midnight Jan 1st 1970) of the current player's computer, from which you can calculate their real time. The problem is that on Windows, timevar2 doesn't work the same I don't think, it is instead counting the number of seconds since the client was opened which isn't that helpful.

I guess if needs be, you could always present some sort of dialog box to users asking for their timezone and then work it out serverside using some offset.

Crow 06-19-2008 02:57 PM

Quote:

Originally Posted by Skyld (Post 1398007)
On Mac and Linux versions of Graal, timevar2 reveals the UNIX time (seconds since midnight Jan 1st 1970) of the current player's computer, from which you can calculate their real time. The problem is that on Windows, timevar2 doesn't work the same I don't think, it is instead counting the number of seconds since the client was opened which isn't that helpful.

I guess if needs be, you could always present some sort of dialog box to users asking for their timezone and then work it out serverside using some offset.

Doesn't need to be done serverside, at least not if it doesn't have to be exact. You could do it using timevar, which is synced between client and server. Only increments by 1 every 5 seconds, but hey, that should be enough ;D

Kristi 08-06-2008 10:06 PM

Quote:

Originally Posted by Crow (Post 1398015)
Doesn't need to be done serverside, at least not if it doesn't have to be exact. You could do it using timevar, which is synced between client and server. Only increments by 1 every 5 seconds, but hey, that should be enough ;D

only for time and not date, since you don't have a reference point of what day that var is counting from

And yes, I bumped this, it seemed like a good point to make

Crow 08-06-2008 10:24 PM

Quote:

Originally Posted by Kristi (Post 1411926)
only for time and not date, since you don't have a reference point of what day that var is counting from

And yes, I bumped this, it seemed like a good point to make

Quote:

Originally Posted by wiki.graal.net
timevar integer (read only) A timer which is increased each 5 seconds and is snychronized between server and clients; The timer started exactly on 2001-02-01 at 18:33:34 Paris time (opening of Graal2001); on serverside the unixtime (timevar2) is around 981048814 + timevar*5

I dunno, that looks like a pretty precise reference point to me.

Kristi 08-06-2008 10:26 PM

Quote:

Originally Posted by Crow (Post 1411937)
I dunno, that looks like a pretty precise reference point to me.

Go figure, cool I guess

I should go update the time script to reflect that (then it would work clientside)


All times are GMT +2. The time now is 04:49 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.