BF2 Time

From BF2 Technical Information Wiki
Jump to navigation Jump to search

Time is principly measured within Battlefield 2 by means of "wall time"--the time in high-resolution seconds since the server started running (e.g. "443.451488108"). Note that since the BF2 server does not restart between rounds (unlike the servers for Battlefield: 1942 and Battlefield: Vietnam, which both practially reboot between rounds), wall time continues to increase from round to round.

The current wall time can be determined this way:

  timeNow = host.timer_getWallTime()

Most (all?) time-related measurements inside BF2 are in seconds, and are based on wall time.


Other time functions are also available; for example:

 import time
 epochTime = time.time()  # Gives current epoch time (seconds since 1970 Jan 1)
 
 # Or, to get a formatted string containing a more user-friendly date and time:
 dateString = time.strftime("%m-%d-%y %H:%M")

See the Python Library Reference for more information about ways to manipulate dates and times in Python.