summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Mailman/Utils.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Mailman/Utils.py b/Mailman/Utils.py
index 3b300c1b8..c7663c326 100644
--- a/Mailman/Utils.py
+++ b/Mailman/Utils.py
@@ -643,6 +643,15 @@ def unique_message_id(mlist):
return msgid
+# Figure out epoch seconds of midnight at the start of today (or the given
+# 3-tuple date of (year, month, day).
+def midnight(date=None):
+ if date is None:
+ date = time.localtime()[:3]
+ # -1 for dst flag tells the library to figure it out
+ return time.mktime(date + (0,)*5 + (-1,))
+
+
# Utilities to convert from simplified $identifier substitutions to/from
# standard Python $(identifier)s substititions. The "Guido rules" for the