ModernUO/Projects/Server
Kamron Batman fdf8c5cf23
fix: Fixes critical bug in TickCount calculation. (#2151)
### Summary

On some operating systems (like hosted Linux VMs), the `TimeStamp.GetTimeStamp()` CPU tick count will wrap around. This is generally not an issue, except for legacy reasons the TickCount is returned in milliseconds instead of ticks. This means when the values wrap around, they are already divided by the CPU Frequency (usually 1million) and then converted to milliseconds. That means the delta between the tick count before and after wrapping is off by a magnitude of (Frequency / 1000).

Example:

TimeStamp A = 9223372036654775807
Some time has passed:
TimeStamp B = -9223372036654775809

The raw delta is 400_000_000 (400ms) when you do `unchecked(A - B)`.
If we do the calculation AFTER converting it to milliseconds, then:

TickCount A = 9223372036654
TickCount B = -9223372036654

The raw delta is -18446744073308 instead of 400_000_000.

To fix this the calculation was changed so `long` -> `ulong`, then divided, then converted back to `long`, effectively bypassing wrap-around issue.

The new TickCount values in our example become:

TickCount A = 9223372037054
TickCount B = 9223372036654

The delta is 400 (in milliseconds). 🎉
2025-04-09 16:46:53 -07:00
..
Buffers fix: Fixes ObjectPropertyList double return issue (#1969) 2024-10-07 21:21:21 -07:00
Client fix: Fixes TCPServer accept async, makes Firewall/IP Limiter multithreaded (#2134) 2025-02-27 22:19:38 -08:00
Collections fix: Fixes massive capacity bug with pooled ref queue/list (#1865) 2024-07-07 16:18:56 -07:00
Comparers chore: Updates copyright (#1448) 2023-08-09 09:09:26 -07:00
Compression fix: Fixes libdeflate threading issue (#1813) 2024-06-02 15:02:47 -07:00
Configuration feat: Adds configurable skill and stat gain (#1489) 2023-10-14 12:02:36 -07:00
Console fix: Console Input is disabled on Linux when no standard input is attached. (#1809) 2024-06-06 21:20:22 -07:00
ContextMenus fix: Moves ContextMenu out of core, streamlines code, fixes bugs (#1873) 2024-07-20 21:33:23 -07:00
Events fix: Fixes networking issues (#1958) 2024-09-19 16:54:49 -07:00
Exceptions chore: Updates copyright (#1448) 2023-08-09 09:09:26 -07:00
GarbageCollection fix: Adds Gen2 callback for each STArrayPool (#971) 2022-03-26 13:57:42 -07:00
Geometry fix: Fixes cannot see that issue with Map LOS Refactor. (#2103) 2025-02-02 11:38:10 -08:00
Items feat: Replaces params array with params ReadOnlySpan (#2125) 2025-02-13 21:19:02 -08:00
Json fix: Fixes codegenned spawners and adds RunUO spawner import support (#1682) 2024-02-17 10:46:55 -08:00
Localization feat: Updates to .NET 9 (#1984) 2024-12-08 10:16:34 -08:00
Maps fix: Fixes cannot see that issue with Map LOS Refactor. (#2103) 2025-02-02 11:38:10 -08:00
Menus fix: Cleans up core code (#1187) 2022-10-10 21:47:08 -07:00
Migrations fix: Hair and facial hair "teleporting" when mobile dies several times (#1901) 2024-08-07 20:10:23 -07:00
Mobiles feat: Fixes beneficial notoriety checks and adds better young restrictions/messaging (#2000) 2025-01-20 11:27:19 -08:00
Network fix: Fixes CUO connecting with new TCP Peek Filtering (#2137) 2025-03-04 11:00:20 -08:00
PropertyList fix: Fixes ObjectPropertyList double return issue (#1969) 2024-10-07 21:21:21 -07:00
Random fix: Cleans up code with feeding pets and adds batch coin flips random check (#1717) 2024-04-04 15:09:15 -07:00
Regions feat: Replaces params array with params ReadOnlySpan (#2125) 2025-02-13 21:19:02 -08:00
Serialization fix: Fixes issue with delete all of missing type on deserialize (#2129) 2025-02-19 15:36:29 -08:00
Targeting fix: Fixes double calls with Target cancel and spell sequences (#1840) 2024-06-17 15:19:06 -07:00
Text feat: Adds Pre-UOTD single click support for weapons, armor, wands, and clothing (#2053) 2025-01-13 17:04:24 -08:00
TileMatrix feat: Updates to .NET 9 (#1984) 2024-12-08 10:16:34 -08:00
Timer fix: Fixes timer Delay/Next not handling MinValue inputs (#1985) 2024-10-28 17:48:16 -07:00
TimeZones fix: Fixes order of execution with AutoSave and TZ (#1665) 2024-01-24 17:17:45 -08:00
Utilities feat: Replaces params array with params ReadOnlySpan (#2125) 2025-02-13 21:19:02 -08:00
World fix: Moves snapshot request synchronously (#2105) 2025-02-02 13:07:28 -08:00
AssemblyHandler.cs fix: Fixes spawner timer deserialization, decimal deserialization, and adds potion keg reverse lookup (#1711) 2024-03-28 13:34:12 -07:00
Attributes.cs fix: Fixes dupe property copying. Adds IgnoreDupe (#1811) 2024-06-02 15:04:54 -07:00
CityInfo.cs chore: Updates copyright (#1448) 2023-08-09 09:09:26 -07:00
Commands.cs fix: Fixes codegenned spawners and adds RunUO spawner import support (#1682) 2024-02-17 10:46:55 -08:00
Effects.cs fix: Adds GetClients to map iterators (#1574) 2023-10-30 18:49:00 -07:00
EventLoopTasks.cs fix: Fixes TCPServer accept async, makes Firewall/IP Limiter multithreaded (#2134) 2025-02-27 22:19:38 -08:00
ExpansionInfo.cs feat: Adds KR/EC client versions (No actual support yet). (#1506) 2023-09-18 23:53:18 -07:00
Guild.cs feat: Upgrades serialization v4 (Threaded Heap Serialization) (#1947) 2024-09-14 09:57:43 -07:00
HuePicker.cs fix: Cleans up core code (#1187) 2022-10-10 21:47:08 -07:00
IAccount.cs fix: Fixes looking up accounts that were renamed. (#2078) 2025-01-18 17:11:43 -08:00
IEntity.cs feat: Upgrades serialization v4 (Threaded Heap Serialization) (#1947) 2024-09-14 09:57:43 -07:00
Interfaces.cs fix: Fixes respawn command when spawner is off (#1891) 2024-07-28 14:34:23 -07:00
IVirtualCheckGump.cs feat: Moves gumps out of the core (#1916) 2024-08-09 19:07:32 -07:00
KeywordList.cs fix: Cleans up core code (#1187) 2022-10-10 21:47:08 -07:00
Main.cs fix: Fixes critical bug in TickCount calculation. (#2151) 2025-04-09 16:46:53 -07:00
MessageType.cs fix: Moves the rest of the Incoming packets (#1338) 2023-02-10 22:59:36 -08:00
Module.cs fix: Fixes sending packets and sidesteps a major issue with stackalloc and PGO in .NET 8 (#1607) 2023-11-21 12:18:20 -08:00
MultiData.cs feat: Replaces Zlib with LibDeflate (#1774) 2024-05-16 22:53:01 -07:00
Party.cs fix: Cleans up core code (#1187) 2022-10-10 21:47:08 -07:00
Poison.cs fix: Adds ISpanParsable and fixes command conditionals (#1241) 2022-11-12 00:26:02 -08:00
Prompt.cs fix: Cleans up core code (#1187) 2022-10-10 21:47:08 -07:00
Race.cs fix: Fixes TryParse for Race (#1244) 2022-11-12 00:31:25 -08:00
SecureTrade.cs feat: Moves gumps out of the core (#1916) 2024-08-09 19:07:32 -07:00
Serial.cs feat: Updates to .NET 9 (#1984) 2024-12-08 10:16:34 -08:00
Server.csproj fix: Fixes TCPServer accept async, makes Firewall/IP Limiter multithreaded (#2134) 2025-02-27 22:19:38 -08:00
Skills.cs feat: Adds configurable skill and stat gain (#1489) 2023-10-14 12:02:36 -07:00
TileData.cs fix: Cleans up FindItems and removes allocations (#1516) 2023-09-28 22:20:36 -07:00
TileList.cs fix: Refactors getting static tiles to use enumerators (#1611) 2023-11-26 09:39:46 -08:00