From 1a7b38f6f65761deca03743de3cbef8b5eae776a Mon Sep 17 00:00:00 2001 From: Sven Velt Date: Fri, 15 Jul 2011 11:55:33 +0200 Subject: [PATCH] monitoringplugin: Add seconds_to_timedelta() Signed-off-by: Sven Velt --- monitoringplugin.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/monitoringplugin.py b/monitoringplugin.py index a26cbb6..53f9c73 100644 --- a/monitoringplugin.py +++ b/monitoringplugin.py @@ -22,10 +22,10 @@ # along with this file. If not, see . # ##################################################################### -__version__ = '0.0.100802' +__version__ = '0.0.110715' __all__ = ['MonitoringPlugin', 'SNMPMonitoringPlugin'] -import optparse, os, re, sys +import datetime, optparse, os, re, sys try: import netsnmp @@ -296,6 +296,10 @@ class MonitoringPlugin(object): return '%i:%02i:%02i' % (hours, minutes, seconds) + def seconds_to_timedelta(self, seconds): + return datetime.timedelta(seconds=long(seconds)) + + def human_to_number(self, value, total=None): if total: if not self.is_float(total):