From abb42dcd4886705d6ba8af27f68ef605218ac67c Mon Sep 17 00:00:00 2001 From: Philip Paquette Date: Wed, 11 Sep 2019 12:58:45 -0400 Subject: Added ReadtheDocs documentation for the public API - Reformatted the docstring to be compatible - Added tests to make sure the documentation compiles properly - Added sphinx as a pip requirement Co-authored-by: Philip Paquette Co-authored-by: notoraptor --- diplomacy/utils/time.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'diplomacy/utils/time.py') diff --git a/diplomacy/utils/time.py b/diplomacy/utils/time.py index 6f250dd..9ac7edd 100644 --- a/diplomacy/utils/time.py +++ b/diplomacy/utils/time.py @@ -24,6 +24,7 @@ import pytz def str_to_seconds(offset_str): """ Converts a time in format 00W00D00H00M00S in number of seconds + :param offset_str: The string to convert (e.g. '20D') :return: Its equivalent in seconds = 1728000 """ @@ -47,6 +48,7 @@ def str_to_seconds(offset_str): def trunc_time(timestamp, trunc_interval, time_zone='GMT'): """ Truncates time at a specific interval (e.g. 20M) (i.e. Rounds to the next :20, :40, :60) + :param timestamp: The unix epoch to truncate (e.g. 1498746120) :param trunc_interval: The truncation interval (e.g. 60*60 or '1H') :param time_zone: The time to use for conversion (defaults to GMT otherwise) @@ -65,6 +67,7 @@ def trunc_time(timestamp, trunc_interval, time_zone='GMT'): def next_time_at(timestamp, time_at, time_zone='GMT'): """ Returns the next timestamp at a specific 'hh:mm' + :param timestamp: The unix timestamp to convert :param time_at: The next 'hh:mm' to have the time rounded to, or 0 to skip :param time_zone: The time to use for conversion (defaults to GMT otherwise) -- cgit v1.2.3