Limnoria/plugins/Time
Valentin Lorentz 8b26b675ba Use stdlib instead of pytz on Python >= 3.9
Python 3.9 introduced the zoneinfo module, which provides the only
feature we used pytz for (getting a datetime.tzinfo object from
an IANA timezone id); so let's use it instead of a third-party
dependency.
2021-11-08 21:46:48 +01:00
..
local Time: add 'ddate' (#1310) 2017-10-27 19:25:02 +02:00
locales Fix msgfmt warnings. 2020-03-26 22:10:28 +01:00
__init__.py Revert generic 'The Limnoria Contributors' in copyright notices 2021-10-17 09:57:55 +02:00
config.py Revert generic 'The Limnoria Contributors' in copyright notices 2021-10-17 09:57:55 +02:00
messages.pot Squashed commit of the following: 2014-12-20 14:37:27 +01:00
plugin.py Use stdlib instead of pytz on Python >= 3.9 2021-11-08 21:46:48 +01:00
README.rst all plugins: regenerate READMEs 2021-04-22 00:29:15 +02:00
test.py Use stdlib instead of pytz on Python >= 3.9 2021-11-08 21:46:48 +01:00

Documentation for the Time plugin for Supybot

Purpose

A plugin for time-related functions.

Usage

This plugin allows you to use different time-related functions.

Commands

at [<time string>]

Returns the number of seconds since epoch <time string> is. <time string> can be any number of natural formats; just try something and see if it will work. If the <time string> is not given, defaults to now.

ctime [<seconds since epoch>]

Returns the ctime for <seconds since epoch>, or the current ctime if no <seconds since epoch> is given.

ddate [<year> <month> <day>]

Returns a the Discordian date today, or an optional different date.

elapsed <seconds>

Returns a pretty string that is the amount of time represented by <seconds>.

seconds [<years>y] [<weeks>w] [<days>d] [<hours>h] [<minutes>m] [<seconds>s]

Returns the number of seconds in the number of <years>, <weeks>, <days>, <hours>, <minutes>, and <seconds> given. An example usage is "seconds 2h 30m", which would return 9000, which is '3600*2 + 30*60'. Useful for scheduling events at a given number of seconds in the future.

time [<channel>] [<format>] [<seconds since epoch>]

Returns the current time in <format> format, or, if <format> is not given, uses the configurable format for the current channel. If no <seconds since epoch> time is given, the current time is used. If <channel> is given without <format>, uses the format for <channel>.

tztime <region>/<city>

Takes a city and its region, and returns its local time. This command uses the IANA Time Zone Database.

until <time string>

Returns the number of seconds until <time string>.

Configuration

supybot.plugins.Time.format

This config variable defaults to "%Y-%m-%dT%H:%M:%S%z", is network-specific, and is channel-specific.

Determines the format string for timestamps. Refer to the Python documentation for the time module to see what formats are accepted. If you set this variable to the empty string, the timestamp will not be shown.

supybot.plugins.Time.public

This config variable defaults to "True", is not network-specific, and is not channel-specific.

Determines whether this plugin is publicly visible.