pypngtile: Image.cache_mtime()
authorTero Marttila <terom@qmsk.net>
Sat, 04 Oct 2014 01:40:40 +0300
changeset 170 c756bbcbc102
parent 169 b69ffcd1ecc7
child 171 0ff809f855f7
pypngtile: Image.cache_mtime()
python/pypngtile.pyx
--- a/python/pypngtile.pyx	Sat Oct 04 01:04:45 2014 +0300
+++ b/python/pypngtile.pyx	Sat Oct 04 01:40:40 2014 +0300
@@ -32,6 +32,8 @@
 CACHE_STALE     = PT_CACHE_STALE
 CACHE_INCOMPAT  = PT_CACHE_INCOMPAT
 
+import datetime
+
 class Error (Exception) :
     """
         Base class for errors raised by pypngtile.
@@ -102,7 +104,15 @@
         
         # return as a struct
         return infop[0]
+    
+    def cache_mtime (self) :
+        """
+            Return cache's mtime as an UTC datetime.
+        """
 
+        info = self.info()
+
+        return datetime.datetime.utcfromtimestamp(info['cache_mtime'])
 
     def status (self) :
         """