Hi there, I just stumbled across some interesting thing that was embedded in a longer story in a customer project which migrates from VisualAge to VA Smalltalk. In order to decide whether an object can or must be updated in the database, they want to find out whether a Timestamp is in the same second as a newly created one. Thus updates shouldn't be possible more often than once a second. The old implementation modified existing timestamps by setting the millieconds to zero. (well, it did something more complicated than that, but...). So I suggested we just use totalSeconds of two timestamps to find out whether they represent the same second. And looking at totalSeconds in AbtTimestamp, that looks just rigt. It returns the Date's asSeconds plus the Time's asSeconds. So far so good. But things went crazy. Two Timestamps that had been equal for years were not any more. I dug down a little deeper and found this: Time>>#asSeconds "Answer an Integer that is the number of seconds since midnight of the receiver." ^millisecondsFromMidnight + 500 // 1000 What....? The seconds are ROUNDED? So if we use #totalSeconds to compare two AbtTimestamps they are only equal if they are in the same half of a second? I would say this is not only surprising, it even doesn't match well with the method's comment. And I'd go so far as to say it is wrong. I would assume that at 18:12:34.953 the number of seconds since midnight is the same number as at 18:12:34.000 and not one more, just because the second is always over. Does this make sense at all? What is the idea behind this? Joachim You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/cde51a52-d1fc-4460-b956-e4446ce70f6en%40googlegroups.com. |
always -> almost
Joachim Tuchel schrieb am Montag, 8. Februar 2021 um 19:37:36 UTC+1:
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/f515a396-39db-44bb-ab37-8fdb3c187862n%40googlegroups.com. |
Hi Joachim,
We'll have to do some software archeology on this one. I do see a forum post here on the matter and we'll just have to work our way backwards to the change in 8.0.3 https://groups.google.com/u/1/g/va-smalltalk/c/wgnMcOSOtrA/m/wH_SVMrxpSAJ - Seth On Monday, February 8, 2021 at 1:39:20 PM UTC-5 [hidden email] wrote: always -> almost You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/af5f9497-e08c-4c27-bd50-e6a2bcdec04fn%40googlegroups.com. |
The timestamp on the method is 2001.
So I think this puts it in IBM Visualage timeframe, so it will be unlikely I can find the change request associated with this. However, we'll take a look. - Seth On Monday, February 8, 2021 at 2:40:59 PM UTC-5 Seth Berman wrote: Hi Joachim, You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/3b091ad1-08cd-4002-972b-33b8ebdd7121n%40googlegroups.com. |
Hi All,
I ran into this a long time ago. I think (I don't have time to check now) Time changed from milliseconds to microseconds and rounding was added to #asSeconds. I'm sure that is a bug but when I reported it too much time had passed and it was decided not to change it. If one searched the group you might find the conversation. Lou On Monday, February 8, 2021 at 2:47:02 PM UTC-5 Seth Berman wrote: The timestamp on the method is 2001. You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/1ec3ab57-1e02-41de-875e-c0af2a8e3a8fn%40googlegroups.com. |
In reply to this post by Seth Berman
Thanks, Seth, Thanks for looking into this. Going thorugh Lou's thread from 2011, I guess we tend to all agree that rounding the seconds is at least a bit smelly. We are going to implement our own comparison extension method in AbtTimestamp that truncates the Time's seconds. This will at least restore the Application's behaviour. Joachim BTW: you mentioned Software archeology. Ain't it funny how Software evolves into more and more science fields? It once started as a craft of Software Development, these days we have archeology, architecture and whatnot involved. I even work as a Software Geriatrist from time to time, where there is a lot of anaesthetics involved (both for users, management and methods) ;-) Seth Berman schrieb am Montag, 8. Februar 2021 um 20:47:02 UTC+1: The timestamp on the method is 2001. You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/99e6d716-184e-400c-a66d-3b0f65e14207n%40googlegroups.com. |
Hi Joachim from my archiv: VAST 5.0 and before (Windows NT 4.0) Time>>asSeconds "Answer an Integer that is the number of seconds since midnight of the receiver." ^secondsFromMidnight vs VAST 6.04 (last IBM Version, Windows 2000 and later) Time>>asSeconds "Answer an Integer that is the number of seconds since midnight of the receiver." ^millisecondsFromMidnight + 500 // 1000 To look into VAST 5.5 to narrow down would require me to invest some more effort (to install it in an ancient Windows). But for short, information from the migration guide 6.0 (out of the information center) tells me Time class shape changed In order to increase the precision of Time, an instance variable, milliseconds, has been added and the secondsSinceMidnight instance variable has been renamed to millisecondsSinceMidnight. This change should be transparent to existing applications since the API for Time was not changed, only extended. The object loader mutation method for Time has been updated to account for the difference in class shape. This will make loading instances of Time that were dumped by a previous version of VisualAge Smalltalk work correctly as long as you did not specify the optimization of not including variable names when you created the dumped file (the default behavior is for variable names to be included). So two things happened: obviously raising the clock granularity from seconds to milliseconds AND hidden here to treat time rolling back as mentioned in the migration guide elsewhere under "Behavior change in handling negative system time" -> e.g. switch summer to winter time etc. Without proof: when switching from seconds to milliseconds the rounding code supported a smooth transition of old code before 6.0 based on ticks per second. A look from today at this code, not knowing about that details, gives you a courious impression about that code fragment. Marcus [hidden email] schrieb am Dienstag, 9. Februar 2021 um 08:43:03 UTC+1:
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/c9be18bd-61dd-4a85-a929-cf8c1487ae0en%40googlegroups.com. |
Marcus, thanks for this additional piece of information. I hadn't dug down that deep into history, I just remembered there was change to the precision of Time values. I would argue that a rounding of milliseconds is not curious, it's dubious ;-) We now added our own extension named secondsFromMidnight to Time which returns millisecondsFromMidnight // 1000, together with a new method on AbtTimestamp that uses this value for comparison down to seconds granularity. Testing is in the works, but I am optimistic. Joachim [hidden email] schrieb am Dienstag, 9. Februar 2021 um 12:43:47 UTC+1:
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/270d6293-37fd-4e71-ab6c-1c41b6e9178dn%40googlegroups.com. |
Administrator
|
In reply to this post by jtuchel
On Monday, February 8, 2021 at 11:43:03 PM UTC-8 [hidden email] wrote:
Smelly? Stinkiest cheese ever! :-) Your requirements, as you described them, were to detect two transactions within one second. So, 58.9 and 59.1 should say they are within one second, not two different seconds. Don't truncate, just take the difference and test that.
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/8e41faf7-6956-4f60-b4f6-633615da6f5bn%40googlegroups.com. |
Richard, I like Cheese a lot, so I find your comparison inappropriate ;-) You are right, a requirement like are these two transactions happening withoin 1 seconds from eacht other woild make sense, buth the way the existing code is implemented is different. It tests whether these two transactions are in the same second. So 58.9 and 59.1 would be false. We need to make sure the application behaves the same as it has been all the years. The rounding would have been slightly better in that case, btw, because it opens up a window of opportunity of an additional 500 msecs ;-)))) Enough joking, the issue is serious ;-) Joachim Richard Sargent schrieb am Dienstag, 9. Februar 2021 um 17:47:17 UTC+1:
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/82f6de02-7d09-41bd-b981-b6009058d6abn%40googlegroups.com. |
Administrator
|
On Tue, Feb 9, 2021 at 9:20 AM Joachim Tuchel <[hidden email]> wrote:
So do I. One of my favourites is Mont d'Or, even stinkier than a well aged Emmentaler, but tastes divine.
Ah, yes. "continue to perform the way it has" is an important consideration and often trumps "work correctly".
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/CAGNapENguRG9AvWz6Y%2BKnVV2NG7XgZAxuxsmZ%2BuAWp0LuYuhnQ%40mail.gmail.com. |
Free forum by Nabble | Edit this page |