From 8195ec35adf7d99c94dc87d7d3eb2c32c2be7252 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ga=C3=ABtan=20de=20Menten?= Date: Thu, 29 Oct 2009 21:24:33 +0000 Subject: [PATCH] large speed improvement of the Interval type on non-native dialects --- lib/sqlalchemy/types.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/sqlalchemy/types.py b/lib/sqlalchemy/types.py index 63a339baf8..92ff274f88 100644 --- a/lib/sqlalchemy/types.py +++ b/lib/sqlalchemy/types.py @@ -1072,16 +1072,17 @@ class Interval(TypeDecorator): """ impl = DateTime + epoch = dt.datetime.utcfromtimestamp(0) def process_bind_param(self, value, dialect): if value is None: return None - return dt.datetime.utcfromtimestamp(0) + value + return self.epoch + value def process_result_value(self, value, dialect): if value is None: return None - return value - dt.datetime.utcfromtimestamp(0) + return value - self.epoch class FLOAT(Float): """The SQL FLOAT type.""" -- 2.47.2