forked from Baystation12/Baystation12
-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Builder13 <null14657322@nullnonexistant.ru>
- Loading branch information
1 parent
fc7f518
commit 402662c
Showing
14 changed files
with
184 additions
and
204 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/// Multiplies by deciseconds in a second | ||
#define SECOND *10 | ||
|
||
/// Multiplies by deciseconds in a second | ||
#define SECONDS *10 | ||
|
||
/// Multiplies by deciseconds in a minute | ||
#define MINUTE *600 | ||
|
||
/// Multiplies by deciseconds in a minute | ||
#define MINUTES *600 | ||
|
||
/// Multiplies by deciseconds in an hour | ||
#define HOUR *36000 | ||
|
||
/// Multiplies by deciseconds in an hour | ||
#define HOURS *36000 | ||
|
||
/// Multiplies by deciseconds in a day | ||
#define DAY *864000 | ||
|
||
/// Multiplies by deciseconds in a day | ||
#define DAYS *864000 | ||
|
||
#define worldtime2stationtime(time) time2text(GLOB.roundstart_hour HOURS + time, "hh:mm") | ||
|
||
#define station_time_in_ticks (GLOB.roundstart_hour HOURS + round_duration_in_ticks) | ||
|
||
#define duration2stationtime(time) time2text(station_time_in_ticks + time, "hh:mm") | ||
|
||
#define round_duration_in_ticks (GLOB.round_start_time ? uptime() - GLOB.round_start_time : 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/// Real time in deciseconds the server process has been active | ||
/proc/uptime() | ||
var/static/days = 0 | ||
var/static/result = 0 | ||
var/static/start_time = world.timeofday | ||
var/static/last_time = start_time | ||
var/time = world.timeofday | ||
if (time == last_time) | ||
return result | ||
if (time < last_time) | ||
++days | ||
last_time = time | ||
result = time - start_time + days DAYS | ||
return result | ||
|
||
|
||
/** | ||
* Non-blocking sleep that allows server state to advance while the | ||
* caller waits for something to be complete, or to pause its own | ||
* behavior to be neighbourly | ||
*/ | ||
/proc/stoplag(initial_delay = world.tick_lag) | ||
if (!Master || !(GAME_STATE & RUNLEVELS_DEFAULT)) | ||
sleep(world.tick_lag) | ||
return 1 | ||
var/delta | ||
var/total = 0 | ||
var/delay = initial_delay / world.tick_lag | ||
do // sleeps have entry overhead from proc duplication so delay scales up under load | ||
delta = delay * max(0.01 * max(world.tick_usage, world.cpu) * max(Master.sleep_delta, 1), 1) | ||
sleep(world.tick_lag * delta) | ||
total += ceil(delta) | ||
delay *= 2 | ||
while (world.tick_usage > min(Master.tick_limit_to_run, Master.current_ticklimit)) | ||
return total |
Oops, something went wrong.