Game Development Community

Current date and time?

by Alexandre Ribeiro de Sa · in Torque Game Builder · 05/19/2007 (11:14 pm) · 4 replies

Hi, there any way to get the current day and time with TGB Script?


Thanks

#1
06/30/2007 (1:32 pm)
Alexandre, there is the 'getRealTime' and 'getSimTime' functions available, not sure if they actually return 'usable' values such as 'March 5th, 2007 12:32 PM' (believe they just return a long value, time in seconds since the epoch [epoch for RealTime is system epoch, epoch for SimTime is game start]).

I believe there are a few resources that return strings and other such values you can use for display though ... however, I think they are C++ resources and require Pro licensing.


#2
07/02/2007 (2:55 pm)
Unfortunately, system epoch is, most of the time (depending on the computer), the boot time. So, no, there's no way to know the currant time with only script.
#3
07/02/2007 (5:59 pm)
I was pretty sure that getRealTime get's the time in seconds since the epoch ... not the boot ... epoch being like 1/1/1970 or whatever it was ...

Might want to verify that though.
#4
07/03/2007 (2:00 pm)
If you have the source, there's a fairly simple fix you can add to the engine to make the full date accessible. Alternately, you can get the time from a server with a TCP object. Both methods are at: www.garagegames.com/mg/forums/result.thread.php?qt=30391