From 90633413bb6c64651d796cc03e749effb3eb76fd Mon Sep 17 00:00:00 2001 From: Jim Paris Date: Tue, 9 Jul 2013 19:01:53 -0400 Subject: [PATCH] Add nilmdb.utils.interval.human_string function --- nilmdb/utils/interval.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nilmdb/utils/interval.py b/nilmdb/utils/interval.py index c36775a..cb16eee 100644 --- a/nilmdb/utils/interval.py +++ b/nilmdb/utils/interval.py @@ -35,6 +35,10 @@ class Interval: return ("[" + nilmdb.utils.time.timestamp_to_string(self.start) + " -> " + nilmdb.utils.time.timestamp_to_string(self.end) + ")") + def human_string(self): + return ("[ " + nilmdb.utils.time.timestamp_to_human(self.start) + + " -> " + nilmdb.utils.time.timestamp_to_human(self.end) + " ]") + def __cmp__(self, other): """Compare two intervals. If non-equal, order by start then end""" return cmp(self.start, other.start) or cmp(self.end, other.end)