adk-python icon indicating copy to clipboard operation
adk-python copied to clipboard

Session lastUpdateTime not in UTC when using SQLite DB

Open cschmidterNBTC opened this issue 1 year ago • 0 comments

Describe the bug The lastUpdateTime for a session (from GET sessions) are not UTC when using a SQLite DB

For example, if the app server's local timezone is EDT (UTC-4):

  1. SQLite func.now() stores actual UTC time, e.g., "2025-06-05 13:00:00".
  2. SQLAlchemy reads this as naive datetime(2025, 6, 5, 13, 0, 0).
  3. Python's naive_dt.timestamp() interprets 13:00:00 as 13:00:00 EDT.
  4. This converts to a Unix timestamp for 17:00:00 UTC (13:00 EDT + 4 hours).
  5. The client receives a timestamp for 4 hours in the future compared to the actual UTC event.

To Reproduce Steps to reproduce the behavior:

  1. Set up google-adk with a SQLite DB
  2. Create and then retrieve a session.
  3. Observe the session.last_update_time value. It will be a Unix timestamp representing a UTC time that is [offset] hours ahead of the actual UTC time of the update. (The offset will match the app server's local timezone offset from UTC).

Expected behavior The timestamp should be in UTC

Desktop:

  • OS: Windows
  • Python version: 3.13
  • ADK version: 1.0.0

cschmidterNBTC avatar Jun 05 '25 13:06 cschmidterNBTC