Commits

James Mills committed 2efaa2a Merge

Merged with 9ca61617328d

  • Participants
  • Parent commits 889a039, 9ca6161

Comments (0)

Files changed (2)

+#!/usr/bin/env python
+
+"""Swatch Internet Time
+
+This little recipe calculates Swatch Internet Time also known as Beats.
+See: http://en.wikipedia.org/wiki/Swatch_Internet_Time
+"""
+
+from time import localtime, timezone
+
+
+def itime():
+    """Calculate and return Swatch Internet Time
+
+    :returns: No. of beats (Swatch Internet Time)
+    :rtype: float
+    """
+
+    h, m, s = localtime()[3:6]
+    beats = ((h * 3600) + (m * 60) + s + timezone) / 86.4
+
+    if beats > 1000:
+        beats -= 1000
+    elif beats < 0:
+        beats += 1000
+
+    return beats
+
+
+def test():
+    print("@{0:0.3f}".format(itime()))
+
+
+if __name__ == "__main__":
+    test()

recipes/mkpasswd.py

File contents unchanged.