mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-26 20:59:27 +01:00
Time.time: reintroduce ability to specify <channel>
This commit is contained in:
parent
cc2780b78a
commit
382f46d7be
@ -159,15 +159,16 @@ class Time(callbacks.Plugin):
|
|||||||
TIME.time)])
|
TIME.time)])
|
||||||
|
|
||||||
@internationalizeDocstring
|
@internationalizeDocstring
|
||||||
def time(self, irc, msg, args, format, seconds):
|
def time(self, irc, msg, args, channel, format, seconds):
|
||||||
"""[<format>] [<seconds since epoch>]
|
"""[<channel>] [<format>] [<seconds since epoch>]
|
||||||
|
|
||||||
Returns the current time in <format> format, or, if <format> is not
|
Returns the current time in <format> format, or, if <format> is not
|
||||||
given, uses the configurable format for the current channel. If no
|
given, uses the configurable format for the current channel. If no
|
||||||
<seconds since epoch> time is given, the current time is used.
|
<seconds since epoch> time is given, the current time is used. If
|
||||||
|
<channel> is given without <format>, uses the format for <channel>.
|
||||||
"""
|
"""
|
||||||
if not format:
|
if not format:
|
||||||
format = self.registryValue('format', msg.args[0])
|
format = self.registryValue('format', channel or msg.args[0])
|
||||||
if tzlocal:
|
if tzlocal:
|
||||||
irc.reply(datetime.fromtimestamp(seconds, tzlocal()).strftime(format))
|
irc.reply(datetime.fromtimestamp(seconds, tzlocal()).strftime(format))
|
||||||
else:
|
else:
|
||||||
@ -175,7 +176,8 @@ class Time(callbacks.Plugin):
|
|||||||
# including at least up to 2.7.5 and 3.2.3. Install dateutil if you
|
# including at least up to 2.7.5 and 3.2.3. Install dateutil if you
|
||||||
# can't upgrade Python.
|
# can't upgrade Python.
|
||||||
irc.reply(time.strftime(format, time.localtime(seconds)))
|
irc.reply(time.strftime(format, time.localtime(seconds)))
|
||||||
time = wrap(time, [optional('nonInt'), additional('float', TIME.time)])
|
time = wrap(time, [optional('channel'), optional('nonInt'),
|
||||||
|
additional('float', TIME.time)])
|
||||||
|
|
||||||
@internationalizeDocstring
|
@internationalizeDocstring
|
||||||
def elapsed(self, irc, msg, args, seconds):
|
def elapsed(self, irc, msg, args, seconds):
|
||||||
|
Loading…
Reference in New Issue
Block a user