Edgewall Software

Ticket #5274: Timestamp.py

File Timestamp.py, 396 bytes (added by dharris <dharris+trac@…>, 17 months ago)

Timestamp macro for use in trac 0.11

Line 
1from trac.core import *
2from trac.wiki.macros import WikiMacroBase
3from StringIO import StringIO
4import time
5
6__all__ = ['TimestampMacro']
7
8class TimestampMacro(WikiMacroBase):
9        """
10        Macro for inserting timestamp
11
12        {{{
13        [[Timestamp]]
14        }}}
15
16        """
17        def expand_macro(self, formatter, name, args):
18                buf = StringIO()
19                t = time.localtime()
20                buf = "<b>%s</b>" % time.strftime('%c', t)
21                return buf
22