[Gambas-user] arithmetic operations on dates and times

Kevin Fishburne kevinfishburne at ...1887...
Thu Jun 9 04:27:58 CEST 2011


Alright, I wouldn't bother the list but this is blowing my mind a little 
bit.

The date and time in the game world should start at an arbitrary point 
and be modified by the system clock on the server and a scale value 
((timebase + timeserver) * timescale = gameworldtime). So if the base 
time starts at the year 1000, the server clock's year is 2011 and the 
time scale is 4 then the game world time should be in the year 12044 
((1000 + 2011) * 4). The date and time ideally would be treated as a 
single entity so everything is scaled by four proportionally.

How in the world would one do this? It's not really important that the 
client know the actual date, but it does need to know the time. The 
client should be able to add "Timer" to the game world time so it can 
keep an accurate 24-hour time while the player is playing. Basically the 
client would receive the game world time upon authentication, then look 
at "gameworldtime + Timer" to determine what time of day it was until 
the player stopped playing.

I noticed that adding and subtracting to a date or time prints a 
floating point number, but multiplying or dividing complains about 
expected datatypes. Any insight or outright solutions would bring light 
and dark to the world. :)

-- 
Kevin Fishburne
Eight Virtues
www: http://sales.eightvirtues.com
e-mail: sales at ...1887...
phone: (770) 853-6271





More information about the User mailing list