nmongeau wrote:Actually, I think your problem is not where you think it is.
Since Time>>#asSeconds trims off the milliseconds, and Time class>>#fromSeconds: converts seconds to milliseconds, an instance created with #fromSeconds: by its very nature has a trimmed down milliseconds value (rounded to the second). And since Time>>#= uses milliseconds as its comparison basis, this can never work (except when creating an instance of Time at exact second boundaries):
| t s t2 |
t := Time now.
s := t asSeconds.
t2 := Time fromSeconds: s.
t = t2
thus (almost) always returns false.
jtuchel wrote:First, there is the question if I can recreate an equal Time instance from some number of seconds that I got from another Time instance.
jtuchel wrote:The second aspect here is that I believe rounding is wrong. If it's 4:32:15.562 am, I would never expect to the result of #asSeconds to return 4:32:16.000 am, but rather 4:32:15.000 am
jtuchel wrote:because that is the number of passed and measured Time units (seconds in that case). Or would you say that 5:32 pm is "around 6:00 pm" ?
jtuchel wrote:I ask such an object for its hours, minutes or seconds, I think the answer should always be truncated.
Users browsing this forum: Yahoo [Bot] and 1 guest