• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

C++ TFS 1.X (1.3 Master) Issue with day and light time.

ObsidianQ

Member
Joined
Jan 26, 2017
Messages
100
Solutions
1
Reaction score
10
Hello,

My TFS has real time clock, which means, if it is 5PM at the host server PC, it is at TFS, if it is 6:22AM, it also is at the TFS inGame. Real time, minute by minute.

My issue is: Right now is 2:47 AM and should be dark. But it looks as "day time light".

What i should do to correct that? :(

Here's the code used to make it real time minute by minute:
game.cpp
Code:
time_t now;

  struct tm serverHour;

  time(&now);  /* get current time; same as: now = time(NULL)  */

  serverHour = *localtime(&now);

  serverHour.tm_hour = 0; serverHour.tm_min = 0; serverHour.tm_sec = 0;

  lightHour =  round(difftime(now,mktime(&serverHour)) / 60);

game.h
Code:
- int32_t lightHour = SUNRISE + (SUNSET - SUNRISE) / 2;
+ int32_t lightHour = 0;

- static constexpr int32_t EVENT_LIGHTINTERVAL = 10000;
+ static constexpr int32_t EVENT_LIGHTINTERVAL = 60000;

- int32_t lightHourDelta = 1400 * 10 / 3600;
+ int32_t lightHourDelta = 1;
 
Back
Top