Time millisecondClockValue

VA Smalltalk is a "100% VisualAge compatible" IDE that includes the original VisualAge technology and the popular VA Assist and WidgetKit add-ons.

Moderators: Eric Clayberg, wembley, tc, Diane Engles, solveig

Time millisecondClockValue

Postby gkipe » Thu May 27, 2010 11:06 am

I have an application that runs on multiple Citrix servers, my Time millisecondClockValue returns 8 digits for one machine, and 10 for the other. Both machines are running the same OS and version. This method calls <primitive: VMprTimeClassMillisecondClockValue>. What is causing different results, exactly what is this primitive calling, a DLL? I want this method to return the same results everytime...granted I can just truncate the result to 8 digits all the time.
Thanks
gkipe
 
Posts: 24
Joined: Tue Feb 03, 2009 11:05 am

Re: Time millisecondClockValue

Postby PhotonDemon » Thu May 27, 2010 2:22 pm

Hi gkipe,

I'm not sure what you are trying to do but I don't think you want to use Time millisecondClockValue. If I remember correctly, this time is supplied by the OS and starts at zero (0) when the OS is booted and is reset to zero after about 64 days if the system is up that long. I use the following to make a GMT timestamp from Windows values. It may be closer to what you are looking for.

Code: Select all
   "Answer GMT date and time from operating system as a Timestamp."
   | systemTime date time |

   systemTime := OSSystemtime new.
   systemTime getSystemTime.
   date := Date newDay: systemTime wDay monthIndex: systemTime wMonth year: systemTime wYear.
   time := (Time new) hours: systemTime wHour minutes: systemTime wMinute seconds: systemTime wSecond milliseconds: systemTime wMilliseconds; yourself.
   ^AbtTimestamp date: date time: time.


Note: There is no guarantee the time you get on different machines will be in sync.

Lou
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:Lou@Keystone-Software.com http://www.Keystone-Software.com
PhotonDemon
[|]
 
Posts: 176
Joined: Thu Dec 20, 2007 1:45 pm

Re: Time millisecondClockValue

Postby gkipe » Thu May 27, 2010 2:33 pm

I didn't mean exactly the same results from different machines, I meant the same number of digits being returned. I would expect the method to return either 8 digits all the time or 10 digits all the time, not different number of digits based on machine. I guess some low level setting or DLL is out of synce between the 2 machines, and I'll have to live with it.
Thanks
gkipe
 
Posts: 24
Joined: Tue Feb 03, 2009 11:05 am

Re: Time millisecondClockValue

Postby PhotonDemon » Thu May 27, 2010 2:56 pm

Hi gkipe,

I think you missed the point of my previous post. A few minutes ago I executed "Time millisecondClockValue" in a workspace and it answered "33109464". I then restarted my Windows 7 system, executed it again and it answered "155564". As you can see the first answer is eight (8) digits and the second is six (6). This is because I first booted about 9 hours ago and then again a few minutes ago.

Lou
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:Lou@Keystone-Software.com http://www.Keystone-Software.com
PhotonDemon
[|]
 
Posts: 176
Joined: Thu Dec 20, 2007 1:45 pm

Re: Time millisecondClockValue

Postby gkipe » Fri May 28, 2010 5:51 am

Ah, I understand now, the method can and will return a different size depending on the reboot ( resets back to zero ). Thanks for the explanation, it takes me a while to digest the responses. -Garet
gkipe
 
Posts: 24
Joined: Tue Feb 03, 2009 11:05 am

Re: Time millisecondClockValue

Postby PhotonDemon » Fri May 28, 2010 6:03 am

Hi Garet,

Ah, I understand now, the method can and will return a different size depending on the reboot ( resets back to zero ). Thanks for the explanation, it takes me a while to digest the responses.


No Problem. May I ask what you are using this value for? Perhaps I can suggest a different time value that will meet your needs better.

Lou
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:Lou@Keystone-Software.com http://www.Keystone-Software.com
PhotonDemon
[|]
 
Posts: 176
Joined: Thu Dec 20, 2007 1:45 pm

Re: Time millisecondClockValue

Postby gkipe » Fri May 28, 2010 6:48 am

We use SOAP/XML to submit Actuate Reports, and we needed a unique name for each report. The quick and dirty way was to simply get a millisecondValue, and I had always seen it to be 8 digits. Now I know better not to use that value ( or we can pad with zeros and/or to truncate ). We were lazy and didnt want to build a new sequencing table to get a unique number.
gkipe
 
Posts: 24
Joined: Tue Feb 03, 2009 11:05 am

Re: Time millisecondClockValue

Postby PhotonDemon » Fri May 28, 2010 7:19 am

Try:

Code: Select all
(AbtTimestamp now asMicroseconds - 3439756800000000) // 1000


which in version 8, will give you the number of milliseconds from 2010/01/01. It is 11 digits. If you want less digits, you can divide by 10000, which would be the number of 100ths of a second from the same date. You get the idea.

Lou
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:Lou@Keystone-Software.com http://www.Keystone-Software.com
PhotonDemon
[|]
 
Posts: 176
Joined: Thu Dec 20, 2007 1:45 pm


Return to VA Smalltalk 7.0, 7.5 & 8.0

Who is online

Users browsing this forum: No registered users and 1 guest