You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by "Jiri Daněk (Jira)" <ji...@apache.org> on 2023/04/13 07:48:00 UTC
[jira] [Updated] (QPID-4804) datetime type and timestamp type convert problem in qpid python client
[ https://issues.apache.org/jira/browse/QPID-4804?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jiri Daněk updated QPID-4804:
-----------------------------
Description:
When client input a value which is datetime type to qpid server, then server receive this value from qpid server, this value's type become timestamp(qpid.datatypes.timestamp), I think the value's type shouldn't change to timestamp.
I think this code do the conversion in /usr/lib/python2.6/site-packages/qpid/codec010.py file:
{code}
def read_datetime(self):
return timestamp(self.read_uint64())
def write_datetime(self, t):
if isinstance(t, datetime.datetime):
t = timestamp(t)
self.write_uint64(t)
{code}
I think maybe we need change code like this, change "return timestamp(self.read_uint64())" to "return datetime.datetime.fromtimestamp(timestamp(self.read_uint64()))"
was:
When client input a value which is datetime type to qpid server, then server receive this value from qpid server, this value's type become timestamp(qpid.datatypes.timestamp), I think the value's type shouldn't change to timestamp.
I think this code do the conversion in /usr/lib/python2.6/site-packages/qpid/codec010.py file:
def read_datetime(self):
return timestamp(self.read_uint64())
def write_datetime(self, t):
if isinstance(t, datetime.datetime):
t = timestamp(t)
self.write_uint64(t)
I think maybe we need change code like this, change "return timestamp(self.read_uint64())" to "return datetime.datetime.fromtimestamp(timestamp(self.read_uint64()))"
> datetime type and timestamp type convert problem in qpid python client
> ----------------------------------------------------------------------
>
> Key: QPID-4804
> URL: https://issues.apache.org/jira/browse/QPID-4804
> Project: Qpid
> Issue Type: Bug
> Components: Python Client
> Affects Versions: 0.18
> Environment: RedHat Linux
> Reporter: Fan Zhang
> Priority: Major
> Attachments: bug-4804-datetime-timestamp-conversion-fix.patch
>
>
> When client input a value which is datetime type to qpid server, then server receive this value from qpid server, this value's type become timestamp(qpid.datatypes.timestamp), I think the value's type shouldn't change to timestamp.
> I think this code do the conversion in /usr/lib/python2.6/site-packages/qpid/codec010.py file:
> {code}
> def read_datetime(self):
> return timestamp(self.read_uint64())
> def write_datetime(self, t):
> if isinstance(t, datetime.datetime):
> t = timestamp(t)
> self.write_uint64(t)
> {code}
> I think maybe we need change code like this, change "return timestamp(self.read_uint64())" to "return datetime.datetime.fromtimestamp(timestamp(self.read_uint64()))"
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org