]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rados.py: fix Snap.get_timestamp
authorJosh Durgin <josh.durgin@dreamhost.com>
Thu, 10 Nov 2011 23:14:20 +0000 (15:14 -0800)
committerJosh Durgin <josh.durgin@dreamhost.com>
Fri, 11 Nov 2011 00:33:46 +0000 (16:33 -0800)
This now uses datetime, imports the right things, and calls the right function.

Fixes #1577
Signed-off-by: Josh Durgin <josh.durgin@dreamhost.com>
src/pybind/rados.py

index e5106a12f58c17d0b1c4b3f96e016f976e919239..570696bd15000247c5a6dd6759e97ab558b3d0d8 100755 (executable)
@@ -1,11 +1,12 @@
 """librados Python ctypes wrapper
 Copyright 2011, Hannu Valtonen <hannu.valtonen@ormod.com>
 """
-from ctypes import CDLL, c_char_p, c_size_t, c_void_p, c_int, \
+from ctypes import CDLL, c_char_p, c_size_t, c_void_p, c_int, c_long, \
     create_string_buffer, byref, Structure, c_uint64, c_ubyte, pointer
 import ctypes
 import errno
 import time
+from datetime import datetime
 
 ANONYMOUS_AUID = 0xffffffffffffffff
 ADMIN_AUID = 0
@@ -340,11 +341,12 @@ class Snap(object):
 
     def get_timestamp(self):
         snap_time = c_long(0)
-        ret = rados_ioctx_snap_get_stamp(self.ioctx.io, self.snap_id,
-                                        byref(snap_time))
+        ret = self.ioctx.librados.rados_ioctx_snap_get_stamp(
+            self.ioctx.io, self.snap_id,
+            byref(snap_time))
         if (ret != 0):
             raise make_ex(ret, "rados_ioctx_snap_get_stamp error")
-        return date.fromtimestamp(snap_time)
+        return datetime.fromtimestamp(snap_time.value)
 
 class Ioctx(object):
     """rados.Ioctx object"""