summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy
diff options
context:
space:
mode:
authorGaëtan de Menten <gdementen@gmail.com>2009-10-29 21:24:33 +0000
committerGaëtan de Menten <gdementen@gmail.com>2009-10-29 21:24:33 +0000
commit8195ec35adf7d99c94dc87d7d3eb2c32c2be7252 (patch)
treeee659905f8ebd5176a7048229dc44510ae03ac48 /lib/sqlalchemy
parent7c6e5dfffd3b855138fb2874f88ca7d8c10241ed (diff)
downloadsqlalchemy-8195ec35adf7d99c94dc87d7d3eb2c32c2be7252.tar.gz
large speed improvement of the Interval type on non-native dialects
Diffstat (limited to 'lib/sqlalchemy')
-rw-r--r--lib/sqlalchemy/types.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/sqlalchemy/types.py b/lib/sqlalchemy/types.py
index 63a339baf..92ff274f8 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."""