ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ Java / JMS » Put date time

Post new topic  Reply to topic
 Put date time « View previous topic :: View next topic » 
Author Message
Biju
PostPosted: Thu Nov 10, 2005 9:47 pm    Post subject: Put date time Reply with quote

Acolyte

Joined: 03 Oct 2005
Posts: 71

Hi Guys,
Here I am with yet another problem. I wanted to know that how timestamps (putDateTime) changes when a message is put in the queue. Let me tell you at first that...I have used the search button on the top and tried my best to find out an answer for my question using the manuals also.
Okay let me tell you the problem I am facin. I wrote a small piece of code to put a message in a remote queue created in a solaris box(Sun Microsystems Inc. SunOS 5.8 Generic Patch December 2002) and Websphere MQ v5.3 with CSD05. I have stopeed the channels and checked the putDate and time (The TZ is set to GMT+5). Now say my system time is 5am the message shows that the put time is 10am(using a browse message application) which is understandable as the QM considers the current time as GMT and adds 5 hours to it.(please correct me if I am wrong). Then I used the Explorer to check the same from a Win XP(MQ v5.3 and CSD05) and it shows me 15.30 pm.(the time zone is GMT+5.30).
Why does this happen? Is it that again the put time is considered as GMT base time and another 5.30 hours are added to the current put time (the calculation I made goes like this...5am + 5hrs =10am in the solaris boxand then when I view it from explorer in the Win XP 10am + 5.30hrs = 15.30)...Did somebody notice this earlier and came to any conclusion? Hope this long story make sense and someone would clear my doubts on the same. Thank you for all your time.
Regards
Bijish
Back to top
View user's profile Send private message Yahoo Messenger
Biju
PostPosted: Thu Nov 10, 2005 10:06 pm    Post subject: Reply with quote

Acolyte

Joined: 03 Oct 2005
Posts: 71

here is the code I am using


qmgr = new MQQueueManager(qm);
int openOptions = MQC.MQOO_OUTPUT | MQC.MQOO_SET_ALL_CONTEXT;
MQPutMessageOptions pmo = new MQPutMessageOptions();
pmo.options = (int)MQC.MQPMO_SET_ALL_CONTEXT;
q = qmgr.accessQueue(lq,openOptions);
MQMessage msg = new MQMessage();
for(int i = 0; i < noMsgs; i++)
{
msg.clearMessage();
msg.correlationId = MQC.MQCI_NONE;
msg.messageId = MQC.MQMI_NONE;
TimeZone tz = TimeZone.getDefault();
msg.putDateTime = new java.util.GregorianCalendar(tz);

//msg.putDateTime = new java.util.GregorianCalendar(2004,11,11,11,11,11);
msg.writeString("Hello message number ==> "+i );
System.out.println("Message Put time..."+(java.util.GregorianCalendar)msg.putDateTime);
q.put(msg, pmo);
}
qmgr.commit();
q.close();
System.out.println("Message Put Successfully...");
qmgr.disconnect();
qmgr.close();
Back to top
View user's profile Send private message Yahoo Messenger
Mr Butcher
PostPosted: Thu Nov 10, 2005 11:51 pm    Post subject: Reply with quote

Padawan

Joined: 23 May 2005
Posts: 1716

puttime is gmt. if you modify the puttime to match your timezome (e.g. gmt+5), how should other systems know about that? they will still interpret is as a gmt time.
_________________
Regards, Butcher
Back to top
View user's profile Send private message
Biju
PostPosted: Fri Nov 11, 2005 12:45 am    Post subject: Reply with quote

Acolyte

Joined: 03 Oct 2005
Posts: 71

puttime is gmt

OK I agree with that.
Quote:


if you modify the puttime to match your timezome (e.g. gmt+5),


if I comment those bold lines also it doesnt make any differrence. Again if I print the put time it will show me 10am if the current system time is 5am(I have TZ gmt+5 set), using the browse application running in the same system. My question is Does the Win XP MQ explorer interpret the put time as gmt again(that is 10am) and show us the put time of that message as gmt+5.30(TZ of Win XP) that is 15.30pm. Is it how it works for MQ?
Regards
Biju[/quote]
Back to top
View user's profile Send private message Yahoo Messenger
Mr Butcher
PostPosted: Fri Nov 11, 2005 12:56 am    Post subject: Reply with quote

Padawan

Joined: 23 May 2005
Posts: 1716

i dont understand your question. the puttime is always interpreted as gmt. so does the MQ explorer.
_________________
Regards, Butcher
Back to top
View user's profile Send private message
Biju
PostPosted: Fri Nov 11, 2005 5:09 am    Post subject: Reply with quote

Acolyte

Joined: 03 Oct 2005
Posts: 71

Hello Mr Butcher,
Sorry for not being clear. But I dont know how should I explain it again. Let me try....
When I put a message to a queue the MQ interpret the current system time as GMT and coverts it according to the TZ(if the TZ is GMT +2 MQ will add 2 to the system time and makes it the putDatetime). Now assuming that the system time is 8am...the putDateTime will be 10am for that particular message. (This all happens in a solaris box).
Now when I try to vie the message putDateTime using the explorer in another system(XP) the explorer adds another 5 hours(if TZ is GMT+5) to the putDateTime available in the message and ultimately gives me the value as 15pm. I wanted to make sure that MQ is designed to work in the above explained manner. The explorer also considers the putDateTime as GMT base time though it is GMT+2 already. Is what I understood correct?Thats all I want to know. Sorry for the trouble caused if any.
Regards
Bijjish
Back to top
View user's profile Send private message Yahoo Messenger
Mr Butcher
PostPosted: Fri Nov 11, 2005 5:35 am    Post subject: Reply with quote

Padawan

Joined: 23 May 2005
Posts: 1716

Quote:
When I put a message to a queue the MQ interpret the current system time as GMT and coverts it according to the TZ(if the TZ is GMT +2 MQ will add 2 to the system time and makes it the putDatetime)


no. mayby your program is doing that, but mq is not doing that.

if you do not set the time in your program, and if you are gmt + 2 and your local time is 10:00 the puttime in the message will be 08:00 and not 12:00


my computer time shows 14:00, i am gmt + 1, when i put to MQ (without setting the time) and use amqsbcg to check the message content, the puttine is 13:00, which is gmt.

now, when i look at the same message with the mq explorer, the mq explorer shows 14:00 because the mq explorer adds that one hour, but this is just a display application. other applications (e.g MO71) show 13:00 puttime, because they do not add the time offset.

now, lets assume my put program (NOT MQ) adds 1 hour because i am GMT + 1, the md puttime in the message will read 14:00. amqsbcg will show 14:00 , mq explorer will show 15:00 (because he adds 1 hour to the time being displayed (leaving the time in the message header unchanged)), and MO71 will show 14:00.

the time in the puttime is always treated as gmt. what you get displayed is just a matter of the display program.
_________________
Regards, Butcher
Back to top
View user's profile Send private message
Biju
PostPosted: Mon Nov 14, 2005 9:26 pm    Post subject: Reply with quote

Acolyte

Joined: 03 Oct 2005
Posts: 71

Hi Butcher,
I am sorry to come back with the same thing again. Here is the output I got from the system I work on. It shows the date and TZ and the message with its header....I am not able to comprehend it with what you have told me in the last reply. Hope you (anyone) could help me out with why is it happening in the exactly opposite way.

bash-2.03$ amqsput QR.SOURCE QM.TEST
Sample AMQSPUT0 start
target queue is QR.SOURCE
Hello there

Sample AMQSPUT0 end
bash-2.03$ date
Mon Nov 14 05:59:45 GMT 2005
bash-2.03$ echo $TZ
GMT+5
bash-2.03$ amqsbcg XL.SOURCE QM.TEST

AMQSBCG0 - starts here
**********************

MQOPEN - 'XL.SOURCE'


MQGET of message number 1
****Message descriptor****

StrucId : 'MD ' Version : 2
Report : 0 MsgType : 8
Expiry : -1 Feedback : 0
Encoding : 273 CodedCharSetId : 819
Format : 'MQXMIT '
Priority : 0 Persistence : 0
MsgId : X'414D5120514D2E5445535420202020204373232B20001402'
CorrelId : X'414D5120514D2E5445535420202020204373232B20001401'
BackoutCount : 0
ReplyToQ : ' '
ReplyToQMgr : 'QM.TEST '
** Identity Context
UserIdentifier : 'mqm '
AccountingToken :
X'0335303500000000000000000000000000000000000000000000000000000006'
ApplIdentityData : ' '
** Origin Context
PutApplType : '7'
PutApplName : 'QM.TEST '
PutDate : '20051114' PutTime : '10594016'
ApplOriginData : ' '

GroupId : X'000000000000000000000000000000000000000000000000'
MsgSeqNumber : '1'
Offset : '0'
MsgFlags : '0'
OriginalLength : '-1'

**** Message ****

length - 439 bytes

00000000: 5851 4820 0000 0001 514C 2E41 4D54 494E 'XQH ....QL.AMTIN'
00000010: 2020 2020 2020 2020 2020 2020 2020 2020 ' '
00000020: 2020 2020 2020 2020 2020 2020 2020 2020 ' '
00000030: 2020 2020 2020 2020 514D 2E42 494A 4920 ' QM.BIJI '
00000040: 2020 2020 2020 2020 2020 2020 2020 2020 ' '
00000050: 2020 2020 2020 2020 2020 2020 2020 2020 ' '
00000060: 2020 2020 2020 2020 4D44 2020 0000 0001 ' MD ....'
00000070: 0000 0000 0000 0008 FFFF FFFF 0000 0000 '................'
00000080: 0000 0111 0000 0333 4D51 5354 5220 2020 '.......3MQSTR '
00000090: 0000 0000 0000 0000 414D 5120 514D 2E54 '........AMQ QM.T'
000000A0: 4553 5420 2020 2020 4373 232B 2000 1401 'EST Cs#+ ...'
000000B0: 0000 0000 0000 0000 0000 0000 0000 0000 '................'
000000C0: 0000 0000 0000 0000 0000 0000 2020 2020 '............ '
000000D0: 2020 2020 2020 2020 2020 2020 2020 2020 ' '
000000E0: 2020 2020 2020 2020 2020 2020 2020 2020 ' '
000000F0: 2020 2020 2020 2020 2020 2020 514D 2E54 ' QM.T'
00000100: 4553 5420 2020 2020 2020 2020 2020 2020 'EST '
00000110: 2020 2020 2020 2020 2020 2020 2020 2020 ' '
00000120: 2020 2020 2020 2020 2020 2020 6D71 6D20 ' mqm '
00000130: 2020 2020 2020 2020 0335 3035 0000 0000 ' .505....'
00000140: 0000 0000 0000 0000 0000 0000 0000 0000 '................'
00000150: 0000 0000 0000 0006 2020 2020 2020 2020 '........ '
00000160: 2020 2020 2020 2020 2020 2020 2020 2020 ' '
00000170: 2020 2020 2020 2020 0000 0006 616D 7173 ' ....amqs'
00000180: 7075 7420 2020 2020 2020 2020 2020 2020 'put '
00000190: 2020 2020 2020 2020 3230 3035 3131 3134 ' 20051114'
000001A0: 3130 3539 3430 3136 2020 2020 4865 6C6C '10594016 Hell'
000001B0: 6F20 7468 6572 65 'o there '



No more messages
MQCLOSE
MQDISCbash-2.03$
Regards,
Bijish
Back to top
View user's profile Send private message Yahoo Messenger
EddieA
PostPosted: Mon Nov 14, 2005 10:42 pm    Post subject: Reply with quote

Jedi

Joined: 28 Jun 2001
Posts: 2453
Location: Los Angeles

Quote:
bash-2.03$ date
Mon Nov 14 05:59:45 GMT 2005
bash-2.03$ echo $TZ
GMT+5

That, to me, looks like you have your system set up wrong. The "date" command is saying your TimeZone is set to GMT. But the $TZ varaiable is saying you are 5 hours "away" from GMT. One of them is wrong.

Cheers,
_________________
Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » Put date time
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.