Browse Source

Add nilmdb.utils.interval.human_string function

tags/nilmdb-1.8.1
Jim Paris 9 years ago
parent
commit
90633413bb
1 changed files with 4 additions and 0 deletions
  1. +4
    -0
      nilmdb/utils/interval.py

+ 4
- 0
nilmdb/utils/interval.py View File

@@ -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)


Loading…
Cancel
Save