You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by as...@apache.org on 2016/09/15 18:48:21 UTC

qpid-proton git commit: OTON-1302: Fixup to bf615adf to implement fallback timestamp::now() when C++11 is not present

Repository: qpid-proton
Updated Branches:
  refs/heads/master 0e768cd35 -> 44875208a


OTON-1302: Fixup to bf615adf to implement fallback timestamp::now() when C++11 is not present


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/44875208
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/44875208
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/44875208

Branch: refs/heads/master
Commit: 44875208a1d186f6fe265c972bfb03b3ad21f9f6
Parents: 0e768cd
Author: Andrew Stitcher <as...@apache.org>
Authored: Thu Sep 15 14:47:06 2016 -0400
Committer: Andrew Stitcher <as...@apache.org>
Committed: Thu Sep 15 14:47:06 2016 -0400

----------------------------------------------------------------------
 proton-c/bindings/cpp/src/timestamp.cpp | 7 +++++++
 1 file changed, 7 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/44875208/proton-c/bindings/cpp/src/timestamp.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/timestamp.cpp b/proton-c/bindings/cpp/src/timestamp.cpp
index b763096..da7c49f 100644
--- a/proton-c/bindings/cpp/src/timestamp.cpp
+++ b/proton-c/bindings/cpp/src/timestamp.cpp
@@ -26,6 +26,8 @@
 
 #if PN_CPP_HAS_CHRONO
 #include <chrono>
+#else
+#include <time.h>
 #endif
 
 namespace proton {
@@ -35,6 +37,11 @@ timestamp timestamp::now() {
     using namespace std::chrono;
     return timestamp( duration_cast<std::chrono::milliseconds>(system_clock::now().time_since_epoch()).count() );
 }
+#else
+// Fallback with low (seconds) precision
+timestamp timestamp::now() {
+    return timestamp( time(0)*1000 );
+}
 #endif
 
 std::ostream& operator<<(std::ostream& o, timestamp ts) { return o << ts.milliseconds(); }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org