From f44be3b864437da5fa8f50d6b971e064270db97b Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Tue, 1 Feb 2005 09:53:08 +0000 Subject: [PATCH] Allow timestamps in format to be None, indicating the current time. --- src/conf.py | 2 ++ src/utils/str.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/conf.py b/src/conf.py index 3407a36c0..027ae485c 100644 --- a/src/conf.py +++ b/src/conf.py @@ -282,6 +282,8 @@ registerChannelValue(supybot.reply.format, 'time', for the time module to see valid formatting characters for time formats.""")) def timestamp(t): + if t is None: + t = time.time() t = time.localtime(t) format = conf.get(supybot.reply.format.time, dynamic.channel) return time.strftime(format, t) diff --git a/src/utils/str.py b/src/utils/str.py index bd24032d1..f96a813f1 100644 --- a/src/utils/str.py +++ b/src/utils/str.py @@ -334,6 +334,8 @@ def toBool(s): # Replace me! def timestamp(t): + if t is None: + t = time.time() return time.ctime(t) _formatRe = re.compile('%([bfhiLnpqstu%])')