How would you like to link game time to the real world time? When it is night outside it is night in the game, when it is day outside, it is day in the game too. DayZ Mod had this functionality achieved by getting server time from the database. But you can also get server machine time directly.

So I’ve made this lightweight extension that would get server local time and output it in the date format ready to be set with setDate. Local time may or may not include DST (day light savings offset). However if you need pure GMT, you can just indicate so when calling extension (see examples).

As usual, download real_date_v1.1 zip,  unzip and drop the real_date.dll in the relevant Arma root folder on the server. To use it you have to add the following in init.sqf:

//to set local date if (isDedicated) then { setDate call compile ("real_date" callExtension ""); }; //or to set GMT date if (isDedicated) then { setDate call compile ("real_date" callExtension "GMT"); };

Remember, if you execute setDate after mission has already started, it will only change the date on the server and will not sync it with clients. To be synced with all clients, it has to be executed upon mission start. After that the sync will happen automatically every 5 minutes.

NOTE: While making this extension I discovered a bug with ArmA 3 setDate. The year will not sync correctly no matter what. Let’s hope this will get fixed promptly. In the meantime you can set the year to current year in “Intel” setting of the Arma 3 editor or straight in the mission.sqm by editing the Intel section inside the file.


real_date v3.0 is now availaible

UPDATE: Recompiled real_date to make it work on older Windows. It is now v1.1, link is also updated.

UPDATE: If you have MSVCP100.dll is missing message, this file should be in C:\WINDOWS\system32 directory. Do not put it in Arma root dir. This extension has been compiled in VS2010 and missing .dll should be part of Microsoft Visual C++ 2010 Redistributable Package (x86).