Ticket #5274: Timestamp.py
| File Timestamp.py, 396 bytes (added by dharris <dharris+trac@…>, 5 years ago) |
|---|
| Line | |
|---|---|
| 1 | from trac.core import * |
| 2 | from trac.wiki.macros import WikiMacroBase |
| 3 | from StringIO import StringIO |
| 4 | import time |
| 5 | |
| 6 | __all__ = ['TimestampMacro'] |
| 7 | |
| 8 | class 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 |
