summaryrefslogtreecommitdiffstats
path: root/src/Date.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Date.cpp')
-rw-r--r--src/Date.cpp22
1 files changed, 10 insertions, 12 deletions
diff --git a/src/Date.cpp b/src/Date.cpp
index 8b8e650..cbfa123 100644
--- a/src/Date.cpp
+++ b/src/Date.cpp
@@ -34,8 +34,8 @@ Date::Date(plist_t node, Node* parent) : Node(node, parent)
34 34
35Date::Date(const PList::Date& d) : Node(PLIST_DATE) 35Date::Date(const PList::Date& d) : Node(PLIST_DATE)
36{ 36{
37 timeval t = d.GetValue(); 37 int64_t t = d.GetValue();
38 plist_set_date_val(_node, t.tv_sec, t.tv_usec); 38 plist_set_unix_date_val(_node, t);
39} 39}
40 40
41Date& Date::operator=(const PList::Date& d) 41Date& Date::operator=(const PList::Date& d)
@@ -45,9 +45,9 @@ Date& Date::operator=(const PList::Date& d)
45 return *this; 45 return *this;
46} 46}
47 47
48Date::Date(timeval t) : Node(PLIST_DATE) 48Date::Date(int64_t t) : Node(PLIST_DATE)
49{ 49{
50 plist_set_date_val(_node, t.tv_sec, t.tv_usec); 50 plist_set_unix_date_val(_node, t);
51} 51}
52 52
53Date::~Date() 53Date::~Date()
@@ -59,18 +59,16 @@ Node* Date::Clone() const
59 return new Date(*this); 59 return new Date(*this);
60} 60}
61 61
62void Date::SetValue(timeval t) 62void Date::SetValue(int64_t t)
63{ 63{
64 plist_set_date_val(_node, t.tv_sec, t.tv_usec); 64 plist_set_unix_date_val(_node, t);
65} 65}
66 66
67timeval Date::GetValue() const 67int64_t Date::GetValue() const
68{ 68{
69 int32_t tv_sec = 0; 69 int64_t sec = 0;
70 int32_t tv_usec = 0; 70 plist_get_unix_date_val(_node, &sec);
71 plist_get_date_val(_node, &tv_sec, &tv_usec); 71 return sec;
72 timeval t = {tv_sec, tv_usec};
73 return t;
74} 72}
75 73
76} // namespace PList 74} // namespace PList