API: get changes since
[wolnelektury.git] / apps / api / helpers.py
diff --git a/apps/api/helpers.py b/apps/api/helpers.py
new file mode 100644 (file)
index 0000000..f01522a
--- /dev/null
@@ -0,0 +1,8 @@
+# -*- coding: utf-8 -*-
+
+from time import mktime
+
+def timestamp(dtime):
+    "converts a datetime.datetime object to a timestamp with fractional part"
+    return mktime(dtime.timetuple()) + dtime.microsecond / 1000000.0
+