On 2012-12-30, at 05:42, Max Leske <maxleske@gmail.com> wrote:
Hm. Ok. It still looks really weird. The comment in #midnight states that it answers midnight in the local time zone. That comment is now wrong, isn't it? #midnight now answers midnight UTC (??).
In any case, I see two problems: 1. as already said, comparison operations on Date are broken (and on DateAndTime) 2. "midnight" is no longer the same as "midnight". Consider the following example:
now := DateAndTime now. midnight := now - now hours hours - now minutes minutes - now seconds seconds - now nanoSecond nanoSecond. midnight = DateAndTime midnight "---> true"
Interestingly, this evaluates to true in both 1.4 and 2.0. BUT: in 2.0 the objects have different julian day numbers and different seconds. I would hardly call those objects equalâ¦
thats a fully correct observation but a wrong conclusion :) old: internal, external representation and 0-point were local time new: internal representation and 0-point are in UTC, external representation are in local time for comparisons we now simply compare the internal representation in UTC, which makes everything way simpler.
I'm also pretty unhappy with the API changes to DateAndTime. For instance, "DateAndTime now seconds" is not the same as "DateAndTime now instVarNamed: 'seconds'". That's really frustrating when debugging those objects.
Sorry Cami, I know that's your work :)
haha well consider it as one of these nasty things in pharo you got used to. DateAndTime was sincerely broken in pre 2.0 images. Moving an image between a timezone yielded wrong DateAndTimes (which btw happens twice per year when switching from/to daylight saving time). The only way to solve the mess is to have a fixed reference point, in this case UTC. - internally everything is in UTC - externally everything is in local time believe me that was harder than you think ;) we did a nasty hackathon of 8hours to get "everything" straight. That said, it might be confusing compared to pre 2.0 images but it makes definitely more sense. Hence I can only conclude that the code you use from pre 2.0 era is wrong :D