summary refs log tree commit diff
path: root/unscoop.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-07-08 13:01:06 -0400
committerJune McEnroe <june@causal.agency>2020-07-08 13:01:06 -0400
commite34558412ae4b45e99d5efc25e0d9a47a97e1669 (patch)
tree21b53548ef4adb603c95052dce226ab08775fdbe /unscoop.c
parentAllocate enough bind space for :open and :close (diff)
downloadlitterbox-e34558412ae4b45e99d5efc25e0d9a47a97e1669.tar.gz
litterbox-e34558412ae4b45e99d5efc25e0d9a47a97e1669.zip
Convert timestamps to unix epoch time
This saves 125 MB on my own database after VACUUM.
Diffstat (limited to 'unscoop.c')
-rw-r--r--unscoop.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/unscoop.c b/unscoop.c
index 4392816..033c1dd 100644
--- a/unscoop.c
+++ b/unscoop.c
@@ -263,8 +263,8 @@ static void prepareInsert(void) {
 		SELECT
 			// SQLite expects a colon in the timezine, but ISO8601 does not.
 			CASE WHEN :time LIKE '%Z'
-				THEN datetime(:time)
-				ELSE datetime(substr(:time, 1, 22) || ':' || substr(:time, -2))
+				THEN strftime('%s', :time)
+				ELSE strftime('%s', substr(:time, 1, 22) || ':' || substr(:time, -2))
 			END,
 			:type, context, names.name, :target, :message
 		FROM contexts, names