Describe the bug
LastUpdated seems to read as local when expected behaviour is to read it as UTC.
To Reproduce
Steps to reproduce the behavior:
Add a trigger to update 'lastUpdated' (Tested SQLITE)
// Create the trigger to automatically update the 'updateAt' column on updates
ExecuteNonQuery(@"CREATE TRIGGER IF NOT EXISTS update_characters_updateAt
AFTER UPDATE ON characters
FOR EACH ROW
BEGIN
UPDATE characters
SET updateAt = CURRENT_TIMESTAMP
WHERE id = OLD.id;
END;"
);
Retrieve from database:
PlayerCharacterData characterData = await GetCharacterWithUserIdValidation(request.CharacterId, request.UserId);
if (characterData != null)
{
long lastOnline = characterData.LastUpdate;
long currentTime = DateTimeOffset.UtcNow.ToUnixTimeSeconds();
long elapsedTime = currentTime - lastOnline;
if (writeAddonLogOfflineRewards)
{
// Convert Unix timestamps to DateTimeOffset
DateTimeOffset lastOnlineTime = DateTimeOffset.FromUnixTimeSeconds(lastOnline);
DateTimeOffset currentDateTime = DateTimeOffset.FromUnixTimeSeconds(currentTime);
Debug.Log($"[DEVEXT] [{name}] - {characterData.CharacterName}");
Debug.Log($"[DEVEXT] [{name}] - Last Online: {lastOnline} (Unix Timestamp) / {lastOnlineTime}");
Debug.Log($"[DEVEXT] [{name}] - Current Time: {currentTime} (Unix Timestamp) / {currentDateTime}");
Debug.Log($"[DEVEXT] [{name}] - Offline Time: {elapsedTime} seconds");
}
}
Notice invalid date/time.
See error
Expected behavior
Wrong behavior Screenshots
Desktop (please complete the following information):
OS: Windows
Version: Latest kit version 1.89
Solution
Specify kind before casting.
Kind is unspecified so the cast treats the date wrong.
Describe the bug LastUpdated seems to read as local when expected behaviour is to read it as UTC.
To Reproduce Steps to reproduce the behavior:
Add a trigger to update 'lastUpdated' (Tested SQLITE)
Retrieve from database:
Notice invalid date/time.
See error
Expected behavior
Wrong behavior Screenshots
Desktop (please complete the following information):
Solution Specify kind before casting. Kind is unspecified so the cast treats the date wrong.