Fix LGPE local time validation (#4445)

The function `IsTimeValid` checks if the received hour, minute, and
second of the Pokémon is below 24, 60, and 60 respectively. For some
reason the current code includes a "+1" for each check, which results in
some legitimate Pokémon being marked as having an invalid timestamp.

Fixed edge cases:
- Received on the 23rd hour.
- Received on the 59th minute.
- Received on the 59th second.
This commit is contained in:
Taylor Rodríguez 2025-02-13 07:46:49 +00:00 committed by GitHub
parent 806548a456
commit b2f962f442
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -83,6 +83,6 @@ public static DateOnly GetRandomDateWithin(DateOnly start, DateOnly end, Random
public static bool IsTimeValid(byte receivedHour, byte receivedMinute, byte receivedSecond)
{
return (receivedHour + 1u) < 24u && (receivedMinute + 1u) < 60u && (receivedSecond + 1u) < 60u;
return receivedHour < 24u && receivedMinute < 60u && receivedSecond < 60u;
}
}