summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSiegfried-Angel Gevatter Pujals <siegfried@gevatter.com>2011-06-30 23:23:37 +0200
committerSiegfried-Angel Gevatter Pujals <siegfried@gevatter.com>2011-06-30 23:23:37 +0200
commitc5363d31cf90b01160ecb180541dc006ae69ca88 (patch)
treefb0c893dc2169bbbb55469f36d551385fcf159e4
parent0f0e09addf66553535ae0479bbc293f8bd1fc258 (diff)
Add .from_timestamp method to TimeRange.
-rw-r--r--zeitgeist/datamodel.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/zeitgeist/datamodel.py b/zeitgeist/datamodel.py
index 614bd7db..b0e65b78 100644
--- a/zeitgeist/datamodel.py
+++ b/zeitgeist/datamodel.py
@@ -329,6 +329,16 @@ class TimeRange(list):
return cls(now - (sec * 1000), now)
@classmethod
+ def from_timestamp(cls, timestamp):
+ """
+ Return a :class:`TimeRange` ranging from the given timestamp until
+ the end of time.
+
+ The given timestamp is expected to be expressed in miliseconds.
+ """
+ return cls(int(timestamp), cls._max_stamp)
+
+ @classmethod
def always(cls):
"""
Return a :class:`TimeRange` from 0 (January 1, 1970) to the most