summaryrefslogtreecommitdiff
path: root/Include/datetime.h
diff options
context:
space:
mode:
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>2012-01-17 21:31:50 +0100
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>2012-01-17 21:31:50 +0100
commit5e8260b09c2aa3faa7ec4722b44e452072301b20 (patch)
treed3e307c0ecbdc97c5d7fee537f68ef500817a9bb /Include/datetime.h
parent0174db50a51cbd03567c5502b3c5362a1357d1bd (diff)
downloadcpython-git-5e8260b09c2aa3faa7ec4722b44e452072301b20.tar.gz
Issue #13727: Add 3 macros to access PyDateTime_Delta members:
PyDateTime_DELTA_GET_DAYS, PyDateTime_DELTA_GET_SECONDS, PyDateTime_DELTA_GET_MICROSECONDS. Please use them instead of directly accessing PyDateTime_Delta struct members.
Diffstat (limited to 'Include/datetime.h')
-rw-r--r--Include/datetime.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/Include/datetime.h b/Include/datetime.h
index db57a18e66..41e3bcf865 100644
--- a/Include/datetime.h
+++ b/Include/datetime.h
@@ -135,6 +135,12 @@ typedef struct
(((PyDateTime_Time*)o)->data[4] << 8) | \
((PyDateTime_Time*)o)->data[5])
+/* Apply for time delta instances */
+#define PyDateTime_DELTA_GET_DAYS(o) (((PyDateTime_Delta*)o)->days)
+#define PyDateTime_DELTA_GET_SECONDS(o) (((PyDateTime_Delta*)o)->seconds)
+#define PyDateTime_DELTA_GET_MICROSECONDS(o) \
+ (((PyDateTime_Delta*)o)->microseconds)
+
/* Define structure for C API. */
typedef struct {