Server time wrong on startup

rosska85

Valued Member!
Hey all, wonder if any of you can help me.
Our server is set to UTC-3 but when the server restarts it it always 12:30 in the afternoon and then after around 5 minutes it suddenly switches to UTC-3 as it should be. I've never seen this happen on a server before so I'm pretty sure I've done something wrong but I can't for the life of me figure it out.

My time setup is like this in the config.
Code:
[Time]
;Possible values: Local, Custom, Static
Type = Custom
;If using Custom type, offset from UTC in hours (can be negative as well)
Offset = -3
;If using Static type (Hour value always the same on every server start), the value (0-24) to set the Hour to
;Hour = 9
 
That's because the server only syncs the time every 5 minutes.

You can change the intervals for when the server syncs the time in server_cleanup.fsm.
Look for this:

class time_sync
{
priority = 0.000000;
to="sync_the_time";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"((diag_tickTime - _lastUpdate) > 300)"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_lastUpdate = diag_tickTime;"/*%FSM</ACTION""">*/;
};

300 equals to 5 minutes. Change this to your liking... May increase server load...

It's my only suggestion really if no one else comes up with a better solution!
I'm learning every day ;)
 
That's because the server only syncs the time every 5 minutes.

You can change the intervals for when the server syncs the time in server_cleanup.fsm.
Look for this:

class time_sync
{
priority = 0.000000;
to="sync_the_time";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"((diag_tickTime - _lastUpdate) > 300)"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_lastUpdate = diag_tickTime;"/*%FSM</ACTION""">*/;
};

300 equals to 5 minutes. Change this to your liking... May increase server load...

It's my only suggestion really if no one else comes up with a better solution!
I'm learning every day ;)

Thanks, I had seen that in there but wasn't sure if adjusting it would cause problems. I'll give it a go and see how I get on. :)
 
Well now in a cruel twist of fate, we switched to Chernarus to try out 1.8 and when the server starts the time is correct but when the time sync kicks in it sets us to 2 PM... Driving me nuts.

Think it has to do with this section, but I don't know if it's safe to edit it or not. Might try tomorrow locally and see how I get on.

Code:
    class sync_the_time
    {
      name = "sync_the_time";
      init = /*%FSM<STATEINIT""">*/"//Send request" \n
      "_key = ""CHILD:307:"";" \n
      "_result = _key call server_hiveReadWrite;" \n
      "_outcome = _result select 0;" \n
      "if(_outcome == ""PASS"") then {" \n
      "    _date = _result select 1;" \n
      "" \n
      "    //date setup" \n
      "    _year = _date select 0;" \n
      "    _month = _date select 1;" \n
      "    _day = _date select 2;" \n
      "    _hour = _date select 3;" \n
      "    _minute = _date select 4;" \n
      "" \n
      "    //Force full moon nights" \n
      "    _date1 = [2012,6,6,14,_minute];" \n
      "" \n
      "    setDate _date1;" \n
      "    dayzSetDate = _date1;" \n
      "    publicVariable ""dayzSetDate"";" \n
      "    diag_log (""TIME SYNC: Local Time set to "" + str(_date1));" \n
      "};"

Edit: Just changed the 14 to _hour and it works fine now.
 
Back
Top