mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-16 08:25:28 +00:00
Rewrite Steam time to ulongs (#2594)
My latest "research" resulted in learning that under the hood, Steam unix time seconds is bullet-proof not only for year 2038 but for uint range as well. While I do not expect to be alive by 2106, let alone ASF still being operative, it makes sense to base our time on the correct backend implementation regardless. Small breaking change for people using `GetUnixTime()`.
This commit is contained in:
committed by
GitHub
parent
715ed034df
commit
7fe5989f5d
@@ -94,7 +94,7 @@ public static class Utilities {
|
||||
}
|
||||
|
||||
[PublicAPI]
|
||||
public static uint GetUnixTime() => (uint) DateTimeOffset.UtcNow.ToUnixTimeSeconds();
|
||||
public static ulong GetUnixTime() => (ulong) DateTimeOffset.UtcNow.ToUnixTimeSeconds();
|
||||
|
||||
[PublicAPI]
|
||||
public static async void InBackground(Action action, bool longRunning = false) {
|
||||
@@ -253,6 +253,16 @@ public static class Utilities {
|
||||
}
|
||||
}
|
||||
|
||||
internal static ulong MathAdd(ulong first, int second) {
|
||||
if (second >= 0) {
|
||||
first += (uint) second;
|
||||
} else {
|
||||
first -= (uint) -second;
|
||||
}
|
||||
|
||||
return first;
|
||||
}
|
||||
|
||||
internal static bool RelativeDirectoryStartsWith(string directory, params string[] prefixes) {
|
||||
if (string.IsNullOrEmpty(directory)) {
|
||||
throw new ArgumentNullException(nameof(directory));
|
||||
|
||||
Reference in New Issue
Block a user