[Pharo-project] What can be negative regarding timezones with date-related objects?
Hi guys. Imagine in Fuel I am serializing date/time-related objects sending these messages: aDate julianDayNumber. aDateAndTime julianDayNumber. aDateAndTime nanoSecond. aDateAndTime secondsSinceMidnight. aDateAndTime offset asSeconds. aDateAndTime offset nanoSeconds. aDuration asSeconds. aDuration nanoSeconds. aTime asSeconds. aTime nanoeSecond. which of those things could answer negative numbers? because once I remember in my image everything was positive, but in other timezone I think "offset asSeconds" and "offset nanoSeconds" were negative in DateAndTime. thanks! -- Mariano http://marianopeck.wordpress.com
Mariano, In normal use, offsets can be negative, yes. But in theory, the JDN could be negative as wel, before -4700 ;-) The seconds/nanoseconds are always positive when normalized. That is how I understand it. Sven PS: nanoseconds and even seconds in the offset are a joke, there are no such timezones. On 09 Jun 2012, at 12:28, Mariano Martinez Peck wrote:
Hi guys. Imagine in Fuel I am serializing date/time-related objects sending these messages:
aDate julianDayNumber. aDateAndTime julianDayNumber. aDateAndTime nanoSecond. aDateAndTime secondsSinceMidnight. aDateAndTime offset asSeconds. aDateAndTime offset nanoSeconds. aDuration asSeconds. aDuration nanoSeconds. aTime asSeconds. aTime nanoeSecond.
which of those things could answer negative numbers? because once I remember in my image everything was positive, but in other timezone I think "offset asSeconds" and "offset nanoSeconds" were negative in DateAndTime.
thanks!
-- Mariano http://marianopeck.wordpress.com
On Sat, Jun 9, 2012 at 12:44 PM, Sven Van Caekenberghe <sven@beta9.be>wrote:
Mariano,
In normal use, offsets can be negative, yes. But in theory, the JDN could be negative as wel, before -4700 ;-) The seconds/nanoseconds are always positive when normalized. That is how I understand it.
Ok, now the other question is if they all need 32 bits integer or if they can ALWAYS fit in something smaller.
Sven
PS: nanoseconds and even seconds in the offset are a joke, there are no such timezones.
On 09 Jun 2012, at 12:28, Mariano Martinez Peck wrote:
Hi guys. Imagine in Fuel I am serializing date/time-related objects sending these messages:
aDate julianDayNumber. aDateAndTime julianDayNumber. aDateAndTime nanoSecond. aDateAndTime secondsSinceMidnight. aDateAndTime offset asSeconds. aDateAndTime offset nanoSeconds. aDuration asSeconds. aDuration nanoSeconds. aTime asSeconds. aTime nanoeSecond.
which of those things could answer negative numbers? because once I remember in my image everything was positive, but in other timezone I think "offset asSeconds" and "offset nanoSeconds" were negative in DateAndTime.
thanks!
-- Mariano http://marianopeck.wordpress.com
-- Mariano http://marianopeck.wordpress.com
So you want the smallest possible binary encoding ? seconds between: 0 and: SecondsInDay (86400) nanoseconds between: 0 and: (10 riasedTo: 9) - 1 jdn is unlimited, how many years do you want to count ? the offset duration cannot be more than 24h I guess. On 09 Jun 2012, at 13:25, Mariano Martinez Peck wrote:
On Sat, Jun 9, 2012 at 12:44 PM, Sven Van Caekenberghe <sven@beta9.be> wrote: Mariano,
In normal use, offsets can be negative, yes. But in theory, the JDN could be negative as wel, before -4700 ;-) The seconds/nanoseconds are always positive when normalized. That is how I understand it.
Ok, now the other question is if they all need 32 bits integer or if they can ALWAYS fit in something smaller.
Sven
PS: nanoseconds and even seconds in the offset are a joke, there are no such timezones.
On 09 Jun 2012, at 12:28, Mariano Martinez Peck wrote:
Hi guys. Imagine in Fuel I am serializing date/time-related objects sending these messages:
aDate julianDayNumber. aDateAndTime julianDayNumber. aDateAndTime nanoSecond. aDateAndTime secondsSinceMidnight. aDateAndTime offset asSeconds. aDateAndTime offset nanoSeconds. aDuration asSeconds. aDuration nanoSeconds. aTime asSeconds. aTime nanoeSecond.
which of those things could answer negative numbers? because once I remember in my image everything was positive, but in other timezone I think "offset asSeconds" and "offset nanoSeconds" were negative in DateAndTime.
thanks!
-- Mariano http://marianopeck.wordpress.com
-- Mariano http://marianopeck.wordpress.com
On Sat, Jun 9, 2012 at 12:44 PM, Sven Van Caekenberghe <sven@beta9.be>wrote:
Mariano,
In normal use, offsets can be negative, yes. But in theory, the JDN could be negative as wel, before -4700 ;-) The seconds/nanoseconds are always positive when normalized.
Are you sure? I have just changed (for testing) to this: DateAndTime localTimeZone: (TimeZone timeZones detect: [:tz | tz abbreviation = 'EST']). And now if I do: DateAndTime now offset asSeconds ----> -18000
That is how I understand it.
Sven
PS: nanoseconds and even seconds in the offset are a joke, there are no such timezones.
On 09 Jun 2012, at 12:28, Mariano Martinez Peck wrote:
Hi guys. Imagine in Fuel I am serializing date/time-related objects sending these messages:
aDate julianDayNumber. aDateAndTime julianDayNumber. aDateAndTime nanoSecond. aDateAndTime secondsSinceMidnight. aDateAndTime offset asSeconds. aDateAndTime offset nanoSeconds. aDuration asSeconds. aDuration nanoSeconds. aTime asSeconds. aTime nanoeSecond.
which of those things could answer negative numbers? because once I remember in my image everything was positive, but in other timezone I think "offset asSeconds" and "offset nanoSeconds" were negative in DateAndTime.
thanks!
-- Mariano http://marianopeck.wordpress.com
-- Mariano http://marianopeck.wordpress.com
On 09 Jun 2012, at 14:24, Mariano Martinez Peck wrote:
The seconds/nanoseconds are always positive when normalized.
Are you sure? I have just changed (for testing) to this:
DateAndTime localTimeZone: (TimeZone timeZones detect: [:tz | tz abbreviation = 'EST']).
And now if I do:
DateAndTime now offset asSeconds ----> -18000
The seconds/nanoseconds in DateAndTime itself are like that, the TZ offset can be positive and negative: http://en.wikipedia.org/wiki/Timezone <<Most of the 40 time zones on land are offset from Coordinated Universal Time (UTC) by a whole number of hours (UTCâ12 to UTC+14), but a few are offset by 30 or 45 minutes.>>
On Sat, Jun 9, 2012 at 2:53 PM, Sven Van Caekenberghe <sven@beta9.be> wrote:
On 09 Jun 2012, at 14:24, Mariano Martinez Peck wrote:
The seconds/nanoseconds are always positive when normalized.
Are you sure? I have just changed (for testing) to this:
DateAndTime localTimeZone: (TimeZone timeZones detect: [:tz | tz abbreviation = 'EST']).
And now if I do:
DateAndTime now offset asSeconds ----> -18000
The seconds/nanoseconds in DateAndTime itself are like that, the TZ offset can be positive and negative:
http://en.wikipedia.org/wiki/Timezone
<<Most of the 40 time zones on land are offset from Coordinated Universal Time (UTC) by a whole number of hours (UTC-12 to UTC+14), but a few are offset by 30 or 45 minutes.>>
Ok, perfect. And what about durations outside DateAndTime. Say if I do: "-123 seconds" is that valid? I mean, should we accept normal durations (not the instVar offset of a DateAndTime) with negative seconds/nanoseconds? thanks -- Mariano http://marianopeck.wordpress.com
Not used as offset in DateAndTime, Durations can be anything, both negative as well as positive, like in '2010-01-02' asDate - '2012-06-08' asDate '2010-01-02' asDate - DateAndTime now On 09 Jun 2012, at 19:53, Mariano Martinez Peck wrote:
On Sat, Jun 9, 2012 at 2:53 PM, Sven Van Caekenberghe <sven@beta9.be> wrote:
On 09 Jun 2012, at 14:24, Mariano Martinez Peck wrote:
The seconds/nanoseconds are always positive when normalized.
Are you sure? I have just changed (for testing) to this:
DateAndTime localTimeZone: (TimeZone timeZones detect: [:tz | tz abbreviation = 'EST']).
And now if I do:
DateAndTime now offset asSeconds ----> -18000
The seconds/nanoseconds in DateAndTime itself are like that, the TZ offset can be positive and negative:
http://en.wikipedia.org/wiki/Timezone
<<Most of the 40 time zones on land are offset from Coordinated Universal Time (UTC) by a whole number of hours (UTCâ12 to UTC+14), but a few are offset by 30 or 45 minutes.>>
Ok, perfect. And what about durations outside DateAndTime. Say if I do: "-123 seconds" is that valid? I mean, should we accept normal durations (not the instVar offset of a DateAndTime) with negative seconds/nanoseconds?
thanks
-- Mariano http://marianopeck.wordpress.com
On Sat, Jun 9, 2012 at 8:05 PM, Sven Van Caekenberghe <sven@beta9.be> wrote:
Not used as offset in DateAndTime, Durations can be anything, both negative as well as positive, like in
'2010-01-02' asDate - '2012-06-08' asDate
'2010-01-02' asDate - DateAndTime now
Ok, thanks Sven.
On 09 Jun 2012, at 19:53, Mariano Martinez Peck wrote:
On Sat, Jun 9, 2012 at 2:53 PM, Sven Van Caekenberghe <sven@beta9.be>
wrote:
On 09 Jun 2012, at 14:24, Mariano Martinez Peck wrote:
The seconds/nanoseconds are always positive when normalized.
Are you sure? I have just changed (for testing) to this:
DateAndTime localTimeZone: (TimeZone timeZones detect: [:tz | tz
abbreviation = 'EST']).
And now if I do:
DateAndTime now offset asSeconds ----> -18000
The seconds/nanoseconds in DateAndTime itself are like that, the TZ offset can be positive and negative:
http://en.wikipedia.org/wiki/Timezone
<<Most of the 40 time zones on land are offset from Coordinated Universal Time (UTC) by a whole number of hours (UTC-12 to UTC+14), but a few are offset by 30 or 45 minutes.>>
Ok, perfect. And what about durations outside DateAndTime. Say if I do: "-123 seconds" is that valid? I mean, should we accept normal durations (not the instVar offset of a DateAndTime) with negative seconds/nanoseconds?
thanks
-- Mariano http://marianopeck.wordpress.com
-- Mariano http://marianopeck.wordpress.com
2012/6/9 Sven Van Caekenberghe <sven@beta9.be>:
Mariano,
In normal use, offsets can be negative, yes. But in theory, the JDN could be negative as wel, before -4700 ;-) The seconds/nanoseconds are always positive when normalized. That is how I understand it.
Sven
PS: nanoseconds and even seconds in the offset are a joke, there are no such timezones.
Oh that's because those stupid administrators did not let an engineer invent the smooth DST ;) (one fraction of seconds every day instead of one hour every 6 months). Nicolas
On 09 Jun 2012, at 12:28, Mariano Martinez Peck wrote:
Hi guys. Imagine in Fuel I am serializing date/time-related objects sending these messages:
aDate julianDayNumber. aDateAndTime julianDayNumber. aDateAndTime nanoSecond. aDateAndTime secondsSinceMidnight. aDateAndTime offset asSeconds. aDateAndTime offset nanoSeconds. aDuration asSeconds. aDuration nanoSeconds. aTime asSeconds. aTime nanoeSecond.
which of those things could answer negative numbers? because once I remember in my image everything was positive, but in other timezone I think "offset asSeconds" and "offset nanoSeconds" were negative in DateAndTime.
thanks!
-- Mariano http://marianopeck.wordpress.com
participants (3)
-
Mariano Martinez Peck -
Nicolas Cellier -
Sven Van Caekenberghe