# HG changeset patch # User Tero Marttila # Date 1412376040 -10800 # Node ID c756bbcbc102b62dc8f3f9d0c5acacbbc2c619ee # Parent b69ffcd1ecc7cb5c608632cb9dc8ee357e523100 pypngtile: Image.cache_mtime() diff -r b69ffcd1ecc7 -r c756bbcbc102 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) : """