diff options
| author | Gordon Sim <gsim@apache.org> | 2012-10-19 17:16:07 +0000 |
|---|---|---|
| committer | Gordon Sim <gsim@apache.org> | 2012-10-19 17:16:07 +0000 |
| commit | de4f16b69fd6a3df74040da7b055fb8d2ba48056 (patch) | |
| tree | 4e8e5a066db948b2f123256bcc8bb5d933f31d9a /cpp/src/qpid/broker/Message.cpp | |
| parent | 6dfe93d5e0f21127d8454d17c6b79a2ec0dc519d (diff) | |
| download | qpid-python-de4f16b69fd6a3df74040da7b055fb8d2ba48056.tar.gz | |
QPID-4368: Pluggable AMQP 1.0 implementation for broker and client
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1400178 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/broker/Message.cpp')
| -rw-r--r-- | cpp/src/qpid/broker/Message.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/cpp/src/qpid/broker/Message.cpp b/cpp/src/qpid/broker/Message.cpp index c48e9bcfa4..431f4291ff 100644 --- a/cpp/src/qpid/broker/Message.cpp +++ b/cpp/src/qpid/broker/Message.cpp @@ -131,6 +131,18 @@ uint64_t Message::getTtl() const } } +bool Message::getTtl(uint64_t ttl) const +{ + if (encoding->getTtl(ttl) && expiration < FAR_FUTURE) { + sys::Duration remaining(sys::AbsTime::now(), getExpiration()); + // convert from ns to ms; set to 0 if expired + ttl = (int64_t(remaining) >= 1000000 ? int64_t(remaining)/1000000 : 0); + return true; + } else { + return false; + } +} + void Message::computeExpiration(const boost::intrusive_ptr<ExpiryPolicy>& e) { //TODO: this is still quite 0-10 specific... |
