Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Accessing Date/Time of Computer Clock. (https://forums.graalonline.com/forums/showthread.php?t=134264591)

jamitsu89 09-19-2011 02:57 PM

Accessing Date/Time of Computer Clock.
 
Is there a way to access the current Date and Time of one's computer clock? I'm looking to incorporate a date and time along with an email when it's sent inside AEON's email system.

Of course I could create a server clock that works on a timezone, and allow players to select their own timezone and have it convert etc, but that's more work than is necessary (particularly as I don't know a lot of timezones).

Many thanks in advance.

fowlplay4 09-19-2011 04:30 PM

Not really, on Mac/Linux you can use timevar2 to calculate it but you should be using a server-side clock though. Otherwise players could just set their clock to a time in the past and send emails from 1980 or something wild like that.

jamitsu89 09-19-2011 10:12 PM

In response to the 1980 thing, I was going to send along the value of timevar2 then when they receive the email, check their clock time and the current value of timevar2, and simply subtract until it is correct. That way the player sending the email would say it has been sent from 1980 (until they change their clock back), but the player receiving would have it state the correct time it was sent, as per their own computer clock.

But since there's not a way to access said clock I guess I'll just use a server-side clock. Thanks buddy.

oralgnome 09-20-2011 02:05 PM

timevar is clientside

edit: timevar2 executed clientside

Crow 09-20-2011 02:11 PM

Quote:

Originally Posted by oralgnome (Post 1668692)
timevar is clientside

timevar is synchronised between serverside and clientside.

oralgnome 09-20-2011 11:40 PM

Quote:

Originally Posted by Crow (Post 1668694)
timevar is synchronised between serverside and clientside.

actually I was thinking of the wrong timevar, timevar2 executed clientside retrieves the unix time of your system

timevar increments at like 5 seconds per tick sry

Crow 09-20-2011 11:46 PM

Quote:

Originally Posted by oralgnome (Post 1668723)
timevar2 executed clientside retrieves the unix time of your system

Not on Windows.

gaben 09-21-2011 12:45 AM

Quote:

Originally Posted by Crow (Post 1668724)
Not on Windows.

It works fine on Windows.

cbk1994 09-21-2011 12:51 AM

Quote:

Originally Posted by gaben (Post 1668726)
It works fine on Windows.

No, it doesn't. On Windows it's the number of seconds since the Graal client has been opened. On Linux and Mac it's the Unix epoch value (same as serverside, but based on the local clock).

gaben 09-21-2011 02:06 AM

Quote:

Originally Posted by cbk1994 (Post 1668728)
No, it doesn't. On Windows it's the number of seconds since the Graal client has been opened. On Linux and Mac it's the Unix epoch value (same as serverside, but based on the local clock).

Eh, I doubt that but whatever. It takes a real man to admit he's wrong.

Crow 09-21-2011 09:22 AM

Quote:

Originally Posted by gaben (Post 1668735)
Eh, I doubt that but whatever. It takes a real man to admit he's wrong.

Man up.

furry_mougle 09-21-2011 01:57 PM

Quote:

Originally Posted by Crow (Post 1668753)
Man up.

I just tested his theory, and sure enough it outputted around 8k seconds which is the accurate time since my computer booted (not Graal).

NO YOU! :cool:

Crow 09-21-2011 06:12 PM

Quote:

Originally Posted by furry_mougle (Post 1668758)
I just tested his theory, and sure enough it outputted around 8k seconds which is the accurate time since my computer booted (not Graal).

NO YOU! :cool:

I've made some experiments myself several times. I still don't know what it depends on, but on my old XP machine it either showed the seconds since Graal was started (and some more, I'm not sure where it got those extra seconds) or the seconds since the OS booted. It was completely random. On my current machine (7) it seems to always show the seconds since the PC booted.

It didn't really matter though. Given the fact that it's different from the way it works on Linux/Mac it's useless for time/date calculations. Still useful for any delta time stuff though, and that's what it's mostly used for I guess.


All times are GMT +2. The time now is 06:16 AM.

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