summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2013-03-08 16:10:12 (GMT)
committerSwift Review <review@swift.im>2013-03-09 18:49:39 (GMT)
commita069a0df0f51a948a86e34d99f952a33eecd97ba (patch)
treeef1fa153fab0b8e4db6893d26148914930025492 /Swiften
parent58a460f442dd85a351cc19edaf390936836dfe1a (diff)
downloadswift-a069a0df0f51a948a86e34d99f952a33eecd97ba.zip
swift-a069a0df0f51a948a86e34d99f952a33eecd97ba.tar.bz2
Show idle time as local time in the UI.
Change-Id: I4aabcd0dfd35fe06ff239dd0fb5f35c57226f461 License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details.
Diffstat (limited to 'Swiften')
-rw-r--r--Swiften/Base/DateTime.cpp5
-rw-r--r--Swiften/Base/DateTime.h5
2 files changed, 10 insertions, 0 deletions
diff --git a/Swiften/Base/DateTime.cpp b/Swiften/Base/DateTime.cpp
index fae26d4..5d192c4 100644
--- a/Swiften/Base/DateTime.cpp
+++ b/Swiften/Base/DateTime.cpp
@@ -10,6 +10,7 @@
#include <boost/date_time/time_facet.hpp>
#include <boost/date_time/local_time/local_time.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
+#include <boost/date_time/c_local_time_adjustor.hpp>
#include <Swiften/Base/String.h>
@@ -31,4 +32,8 @@ std::string dateTimeToString(const boost::posix_time::ptime& time) {
return stampString;
}
+std::string dateTimeToLocalString(const boost::posix_time::ptime& time) {
+ return boost::posix_time::to_simple_string(boost::date_time::c_local_adjustor<boost::posix_time::ptime>::utc_to_local(time));
+}
+
}
diff --git a/Swiften/Base/DateTime.h b/Swiften/Base/DateTime.h
index bc9eecb..891b170 100644
--- a/Swiften/Base/DateTime.h
+++ b/Swiften/Base/DateTime.h
@@ -20,4 +20,9 @@ namespace Swift {
* Converts a UTC ptime object to a XEP-0082 formatted string.
*/
SWIFTEN_API std::string dateTimeToString(const boost::posix_time::ptime& time);
+
+ /**
+ * Converts a UTC ptime object to a localized human readable string.
+ */
+ SWIFTEN_API std::string dateTimeToLocalString(const boost::posix_time::ptime& time);
}