On Oct 1, 2010, at 9:00 AM, Ramsey Gurley wrote: On Oct 1, 2010, at 11:33 AM, Ray Kiddy wrote: <snip> And lots of people have talked, over the years, about a NSWallClockTime/Date class, one that could capture the situation where I look at the clock and see a "2:00" and I want to discuss it with someone else who can look at another clock, regardless of what time zone they are in. Does anyone already have code for that they are planning to check in to Wonder? I have a class, but I am sure others will find it quirky.
- ray
I have every intention of creating a calendarDate prototype as soon as I figure out how to interact with it in the UI. It will probably be something like GregorianCalendar->ERXGregorianCalendar (Subclassed to supply factory methods) & SimpleDateFormat->ERXCalendarFormat (Subclass to translate date strings entered into an ERXGregorianCalendar) & calendarDate prototype with an external type like dateTime to store the data in a way the database can compare. I assume that means it will be normalized to a constant time zone like GMT. And I may make another based on XMLGregorianCalendar for those of us working with JAX-WS web services... But if someone wants to build and test all that for me, I'll welcome it (^_~) Ramsey
It occurred to me that one could choose to not subclass one of the existing calendar or date classes. When I think about what I want a NSWallTime class to capture, it occurs to me that people say things like "It is now 2:04 pm on Thursday, October 5." All I see there are integers and enumerations. This sentence does not say what year it is, and it does not say what time zone one is in. IMHO, the class does not need to assume something you do not tell it.
It seems better to me to have a class that has a very abstract concept of the wall time/date. Can an instance of this be turned into a GregorianCalendar object? Yes, with the other necessary information provided. Should it just guess? Well, that is what is causing problems now, so maybe not. If you want to use a class that thinks it know better than you do what you intend, NSTimestamp is right there.
I suppose that it depends on this. Would this be ok to you or does it offend?
(person in San Francisco) says: sfWallTime = (I spy with my little eye) July 17, 2010 10:05 am. (person in Bangladesh) says: bgWallTIme = (I spy with my little eye) July 17, 2010 10:05 am.
(sfWallTime.equals(bgWallTime)) -> true
(sfWallTime.timeForTimeZone("PDT").equals(bgWallTime.timeForTimeZone("BST")) -> false
What thinks you?
- ray
|