summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2019-12-05 11:20:46 -0500
committerJune McEnroe <june@causal.agency>2019-12-05 11:20:46 -0500
commit5fedc8a9318e5ba1dcfd582b06da8fdea2e13124 (patch)
tree9e6fe097d883cef1796d542ac29bbf8be7c93e28
parentAdd basic unscoop import tool (diff)
downloadlitterbox-5fedc8a9318e5ba1dcfd582b06da8fdea2e13124.tar.gz
litterbox-5fedc8a9318e5ba1dcfd582b06da8fdea2e13124.zip
Insert colons into timezones
-rw-r--r--unscoop.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/unscoop.c b/unscoop.c
index 7679f19..be57128 100644
--- a/unscoop.c
+++ b/unscoop.c
@@ -158,11 +158,15 @@ int main(int argc, char *argv[]) {
 		"INSERT OR IGNORE INTO names (nick, user, host)"
 		"VALUES ($nick, $user, $host);"
 	);
+	// SQLite expects a colon in the timezone, but ISO8601 does not.
 	sqlite3_stmt *insertEvent = dbPrepare(
 		db, SQLITE_PREPARE_PERSISTENT,
 		"INSERT INTO events (contextID, type, time, nameID, target, message)"
-		"SELECT $contextID, $type, $time, id, $target, $message FROM names"
-		" WHERE nick = $nick AND user = $user AND host = $host;"
+		"SELECT"
+		" $contextID, $type,"
+		" datetime(substr($time, 1, 22) || ':' || substr($time, -2)),"
+		" id, $target, $message"
+		" FROM names WHERE nick = $nick AND user = $user AND host = $host;"
 	);
 	dbBindInt(insertEvent, 1, contextID);
 
@@ -194,7 +198,6 @@ int main(int argc, char *argv[]) {
 				if (error) continue;
 
 				dbBindInt(insertEvent, 2, matcher->type);
-				// FIXME: SQLite doesn't parse ISO8601 timezones.
 				bindMatch(insertEvent, 3, line, match[matcher->time]);
 				if (matcher->target) {
 					bindMatch(insertEvent, 4, line, match[matcher->target]);
4827832f049f8c00c2a802e8b396b2ea&follow=1'>Add undo to freecellJune McEnroe 2019-03-29Replace path.h with asset.hJune McEnroe 2019-03-29Add king win faceJune McEnroe 2019-03-29Change king face directionJune McEnroe 2019-03-29Load king bitmaps in freecellJune McEnroe