summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cython/plist.pyx4
1 files changed, 4 insertions, 0 deletions
diff --git a/cython/plist.pyx b/cython/plist.pyx
index 0149ffa..be3fe8a 100644
--- a/cython/plist.pyx
+++ b/cython/plist.pyx
@@ -457,6 +457,8 @@ cdef String String_factory(plist_t c_node, bint managed=True):
457 instance._c_node = c_node 457 instance._c_node = c_node
458 return instance 458 return instance
459 459
460MAC_EPOCH = 978307200
461
460cdef extern from "plist_util.h": 462cdef extern from "plist_util.h":
461 void datetime_to_ints(object obj, int32_t* sec, int32_t* usec) 463 void datetime_to_ints(object obj, int32_t* sec, int32_t* usec)
462 object ints_to_datetime(int32_t sec, int32_t usec) 464 object ints_to_datetime(int32_t sec, int32_t usec)
@@ -470,6 +472,7 @@ cdef plist_t create_date_plist(value=None):
470 node = plist_new_date(0, 0) 472 node = plist_new_date(0, 0)
471 elif check_datetime(value): 473 elif check_datetime(value):
472 datetime_to_ints(value, &secs, &usecs) 474 datetime_to_ints(value, &secs, &usecs)
475 secs -= MAC_EPOCH
473 node = plist_new_date(secs, usecs) 476 node = plist_new_date(secs, usecs)
474 return node 477 return node
475 478
@@ -500,6 +503,7 @@ cdef class Date(Node):
500 cdef int32_t secs = 0 503 cdef int32_t secs = 0
501 cdef int32_t usecs = 0 504 cdef int32_t usecs = 0
502 plist_get_date_val(self._c_node, &secs, &usecs) 505 plist_get_date_val(self._c_node, &secs, &usecs)
506 secs += MAC_EPOCH
503 return ints_to_datetime(secs, usecs) 507 return ints_to_datetime(secs, usecs)
504 508
505 cpdef set_value(self, object value): 509 cpdef set_value(self, object value):