mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-22 12:05:51 -04:00
Tempbans now use UTC timestamp, for consistency with other timestamps stored in files.
This commit is contained in:
parent
1ab66ee98a
commit
f452602912
@ -39,13 +39,20 @@ namespace MCGalaxy {
|
||||
|
||||
public static string PackTempBanData(string reason, string banner, DateTime expiry) {
|
||||
if (reason == null) reason = "-";
|
||||
return banner + " " + expiry.Ticks + " " + reason;
|
||||
return banner + " " + expiry.ToUnixTime() + " " + reason;
|
||||
}
|
||||
|
||||
public static void UnpackTempBanData(string line, out string reason, out string banner, out DateTime expiry) {
|
||||
string[] parts = line.SplitSpaces(3);
|
||||
banner = parts[0];
|
||||
|
||||
// Timestamp used to be raw DateTime ticks, is now UTC timestamp
|
||||
long timestamp = long.Parse(parts[1]);
|
||||
try {
|
||||
expiry = timestamp.FromUnixTime();
|
||||
} catch (ArgumentOutOfRangeException) {
|
||||
expiry = new DateTime(long.Parse(parts[1]), DateTimeKind.Utc);
|
||||
}
|
||||
reason = parts.Length > 2 ? parts[2] : "";
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user