From a260a93eb161c669d3a28ddeb06fe11f9d794132 Mon Sep 17 00:00:00 2001 From: hanez Date: Mon, 20 Jul 2026 22:24:21 +0200 Subject: [PATCH] fix: use localtime for !seen timestamps instead of UTC seen_update() used SQLite's datetime('now') which returns UTC, causing !seen to show wrong times (e.g. 16:00 instead of 18:00 on UTC+2). Changed to datetime('now','localtime') so seen timestamps match the system's local time. Version bumped to 0.36.1. --- CHANGELOG.md | 5 +++++ zynk.c | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ecfb8be..7a823c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +2026.07.20 – Fix !seen showing UTC instead of local time. + +- Fixed `!seen` command storing UTC timestamps instead of local time: `seen_update()` used `datetime('now')` which returns UTC, causing `!seen ` to display a time offset by the server's timezone difference (e.g. 16:00 instead of 18:00 on a UTC+2 system). Changed to `datetime('now','localtime')` so seen timestamps match the system's local time. +- Version bumped to 0.36.1. + 2026.07.20 – Add !gitlog command. - Added `!gitlog [count]` command: displays recent git commits of the zynk project using `git log --oneline`. Defaults to 5 commits (`GITLOG_COUNT`), accepts 1–20 as count. Each commit is sent as a separate IRC message. diff --git a/zynk.c b/zynk.c index c14de08..42bcc55 100644 --- a/zynk.c +++ b/zynk.c @@ -29,7 +29,7 @@ int asprintf(char **, const char *, ...); /* ---- constants ---- */ -#define VERSION "0.36.0" +#define VERSION "0.36.1" #define DEFAULT_SERVER "irc.libera.chat" #define OPENCODE_BIN "/usr/bin/opencode" #define CLR_RESET "\033[0m" @@ -605,8 +605,8 @@ static void ai_reset(long long id) { static void seen_update(const char *nick, const char *channel, const char *action) { void *stmt; const char *sql = "INSERT INTO seen(nick,last_seen,last_channel,last_action)" - " VALUES(?,datetime('now'),?,?)" - " ON CONFLICT(nick) DO UPDATE SET last_seen=datetime('now')," + " VALUES(?,datetime('now','localtime'),?,?)" + " ON CONFLICT(nick) DO UPDATE SET last_seen=datetime('now','localtime')," " last_channel=excluded.last_channel, last_action=excluded.last_action"; if (db_prepare(DB, sql, -1, &stmt, NULL) != SQLITE_OK) return; db_bind_text(stmt, 1, nick, -1, SQLITE_STATIC);