Timespan Month questions

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Timespan Month questions

GLASS mailing list
Ciao,

i have a problem when i use a Month class into glass.

The : ( Month starting: ( Date fromString: '04.01.2015' ))

answer the:

{c} .         -> April 2015

(class)@  -> Month

(oop)@    -> 186660865

duration@ -> 30:00:00:00

start@    -> 2015-04-01T00:00:00+01:00

The relative start@ is set to:


.        -> 2015-04-01T00:00:00+01:00

..       -> April 2015

(class)@ -> DateAndTime

(oop)@   -> 231252225

offset@  -> 3600 ( NOTE IT'S SET TO 3600 )

seconds@ -> 449535600

 


Now when i do: ( Month starting: ( Date fromString: '04.01.2015' )) end

the system answer:

.        -> 2015-04-30T23:59:59.99999898672104+02:00

(class)@ -> DateAndTime

(oop)@   -> 231902721

offset@  -> 7200

seconds@ -> 4,5212399999999899E+08

 

I don't understund because the end method answer aDateAndTime with offset set to 7200.

After what in my code  i have two DateAndTime instance relative to the same " time " :

{a} .        -> 2015-04-30T23:59:59.99999898672104+02:00

(class)@ -> DateAndTime

(oop)@   -> 324717569

offset@  -> 7200

seconds@ -> 4,5212399999999899E+08


{b} .        -> 2015-04-30T23:59:59.99999898672104+01:00

(class)@ -> DateAndTime

(oop)@   -> 324726017

offset@  -> 3600

seconds@ -> 4,5212759999999899E+08

  but the comparing methods:  ( aDateAndTime{b} asDateAndTime between: start{c} and: self end {a} )

rightly, don't answer as i expect.



Considerations ?

Thanks,

Dario

_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass
Reply | Threaded
Open this post in threaded view
|

Re: Timespan Month questions

GLASS mailing list
Hi Dario,

What timezone is your image configured in? 

TimeZone current standardPrintString

DateAndTime in GemStone take the DST (daylight saving time) into account.
If you create a DateAndTime on a particular date, it will automatically adapt the offset to UTC to reflect that.

April 1st is still winter time (UTC+1) and April 30th is summer time (UTC+2). 
In Belgium this happens is in March, so I am a bit surprised about the dates you report, which is why I ask which timezone you are in.

Mind that the two datetimes you mention are _not_ the same (see the value of seconds). 
Comparing datetimes from different timezones works relative to UTC time. 

Does that answer your question?

cheers
Johan



On 25 Jun 2015, at 12:01, Trussardi Dario Romano via Glass <[hidden email]> wrote:

Ciao,

i have a problem when i use a Month class into glass.

The : ( Month starting: ( Date fromString: '04.01.2015' ))

answer the:

{c} .         -> April 2015

(class)@  -> Month

(oop)@    -> 186660865

duration@ -> 30:00:00:00

start@    -> 2015-04-01T00:00:00+01:00

The relative start@ is set to:


.        -> 2015-04-01T00:00:00+01:00

..       -> April 2015

(class)@ -> DateAndTime

(oop)@   -> 231252225

offset@  -> 3600 ( NOTE IT'S SET TO 3600 )

seconds@ -> 449535600

 


Now when i do: ( Month starting: ( Date fromString: '04.01.2015' )) end

the system answer:

.        -> 2015-04-30T23:59:59.99999898672104+02:00

(class)@ -> DateAndTime

(oop)@   -> 231902721

offset@  -> 7200

seconds@ -> 4,5212399999999899E+08

 

I don't understund because the end method answer aDateAndTime with offset set to 7200.

After what in my code  i have two DateAndTime instance relative to the same " time " :

{a} .        -> 2015-04-30T23:59:59.99999898672104+02:00

(class)@ -> DateAndTime

(oop)@   -> 324717569

offset@  -> 7200

seconds@ -> 4,5212399999999899E+08


{b} .        -> 2015-04-30T23:59:59.99999898672104+01:00

(class)@ -> DateAndTime

(oop)@   -> 324726017

offset@  -> 3600

seconds@ -> 4,5212759999999899E+08

  but the comparing methods:  ( aDateAndTime{b} asDateAndTime between: start{c} and: self end {a} )

rightly, don't answer as i expect.



Considerations ?

Thanks,

Dario
_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass


_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass
Reply | Threaded
Open this post in threaded view
|

Re: Timespan Month questions

GLASS mailing list
Ciao Johan,

thanks.

Hi Dario,

What timezone is your image configured in? 

TimeZone current standardPrintString

My environment is set to: 'Germany Standard Time'


DateAndTime in GemStone take the DST (daylight saving time) into account.
If you create a DateAndTime on a particular date, it will automatically adapt the offset to UTC to reflect that.

April 1st is still winter time (UTC+1) and April 30th is summer time (UTC+2). 
In Belgium this happens is in March, so I am a bit surprised about the dates you report, which is why I ask which timezone you are in.

Into GemTools workspace  the code:  ( Month starting: ( Date fromString: '04.01.2015' )) end
 
answer: 2015-04-30T23:59:59.99999898672104+02:00


Mind that the two datetimes you mention are _not_ the same (see the value of seconds). 
Comparing datetimes from different timezones works relative to UTC time. 

Does that answer your question?

I use the: ( Month starting: ( Date fromString: '04.01.2015' )) end

   -> 2015-04-30T23:59:59.99999898672104+02:00

(class)@ -> DateAndTime

(oop)@   -> 231902721

offset@  -> 7200

{ a}  seconds@ -> 4,521 239 9999999899E+08

for select all records relative to the month.


aRecord aDateAndTime < ( Month starting: ( Date fromString: '04.01.2015' )) end

But the last record of April:

{b} .        -> 2015-04-30T23:59:59.99999898672104+01:00

(class)@ -> DateAndTime

(oop)@   -> 324726017

offset@  -> 3600

seconds@ -> 4,521 275 9999999899E+08


 is not select.


The DateAndTimeANSI  <  method  report:

< aDateAndTime
"Synopsis
Answer true if the receiver is less than operand. Answer false otherwise.
Definition: <magnitude>
Answer true if the receiver is less than operand with respect to the ordering defined for them.
Answer false otherwise.
It is erroneous if the receiver and operand are not comparable.
The semantics of the natural ordering must be defined by refinement, which may also restrict the
type of operand.
Refinement: <DateAndTime>
Answer true if the UTC time represented by operand follows the UTC time represented by the
receiver. Answer false otherwise.
If the offsets of the receiver and operand are the same then their order is determined by their
lexical order in the sequence #year, #month, #day, #hour24, #minute, #second. If their
offsets differ then result is the same as if receiver asUTC < operand asUTC were evaluated."
^ self asSeconds < aDateAndTime asSeconds

Where asSeconds   answer: ^ seconds


but { b seconds }  is not  <  of { a seconds }

Thanks for any considerations.

Dario


cheers
Johan



On 25 Jun 2015, at 12:01, Trussardi Dario Romano via Glass <[hidden email]> wrote:

Ciao,

i have a problem when i use a Month class into glass.

The : ( Month starting: ( Date fromString: '04.01.2015' ))

answer the:

{c} .         -> April 2015

(class)@  -> Month

(oop)@    -> 186660865

duration@ -> 30:00:00:00

start@    -> 2015-04-01T00:00:00+01:00

The relative start@ is set to:


.        -> 2015-04-01T00:00:00+01:00

..       -> April 2015

(class)@ -> DateAndTime

(oop)@   -> 231252225

offset@  -> 3600 ( NOTE IT'S SET TO 3600 )

seconds@ -> 449535600

 


Now when i do: ( Month starting: ( Date fromString: '04.01.2015' )) end

the system answer:

.        -> 2015-04-30T23:59:59.99999898672104+02:00

(class)@ -> DateAndTime

(oop)@   -> 231902721

offset@  -> 7200

seconds@ -> 4,5212399999999899E+08

 

I don't understund because the end method answer aDateAndTime with offset set to 7200.

After what in my code  i have two DateAndTime instance relative to the same " time " :

{a} .        -> 2015-04-30T23:59:59.99999898672104+02:00

(class)@ -> DateAndTime

(oop)@   -> 324717569

offset@  -> 7200

seconds@ -> 4,5212399999999899E+08


{b} .        -> 2015-04-30T23:59:59.99999898672104+01:00

(class)@ -> DateAndTime

(oop)@   -> 324726017

offset@  -> 3600

seconds@ -> 4,5212759999999899E+08

  but the comparing methods:  ( aDateAndTime{b} asDateAndTime between: start{c} and: self end {a} )

rightly, don't answer as i expect.



Considerations ?

Thanks,

Dario
_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass



_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass
Reply | Threaded
Open this post in threaded view
|

Re: Timespan Month questions

GLASS mailing list
Ciao,

i setup my TimeZone with:

run
| time |
time:= TimeZone timeDifferenceHrs: 1 dstHrs: 1 atTimeHrs: 2
fromDayNum: 95 toDayNum: 304 on: #Sunday beginning: 1967
stdPrintString: 'Germany Standard Time' dstPrintString: 'Germany Legal Time'.
TimeZone for:#Germany put: time.
TimeZone default: time
%

It's correct ?  ( I think not )

I don't remember where i found this definitions.

How i right setup the Timezone for Italy time?

I need to setup it every year with different parameter ?

Thanks for any considerations.

Dario



_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass
Reply | Threaded
Open this post in threaded view
|

Re: Timespan Month questions

GLASS mailing list
Ciao,

i have this code to collect aDateAndTime for a period: ( Duration days: 300)

| cll |
cll := OrderedCollection new.
( Timespan starting: ( Date fromString: '04.06.2015' ) duration: ( Duration days: 300)) 
every: ( Duration days:1 )  do:[ :aDateAndTime | 
" this is for verify the data " 
( aDateAndTime date =  (Date fromString: '04.30.2015') ) ifTrue:[ aDateAndTime halt]. 

cll add: ( Timespan starting: aDateAndTime duration: ( Duration days: 1)) ].




Now i found this problematic relative to Timespan  every:   do: iteration.


The aDateAndTime generated by iteration don't respect the TimeZone setup

but   all   dateAndTime generated by iteration are setting with a DateAndTime offset   based of the starting point :

( Timespan starting: ( Date fromString: '04.06.2015' ) duration: ( Duration days: 300))

 

In this case:  ( Timespan starting:   ( Date fromString: '04.06.2015' ) duration: ( Duration days: 300)) all aDateAndTime offset is set to 7200

In this case:   ( Timespan starting:  ( Date fromString: '03.01.2015' ) duration: ( Duration days: 300))    all aDateAndTime offset is set to 3600



I hope I was clear.


Thanks for any considerations,

Dario






_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass
Reply | Threaded
Open this post in threaded view
|

Re: TimeZone

GLASS mailing list
In reply to this post by GLASS mailing list
According to the Install Guide: 

GemStone/S 64 Bit is shipped with a default time zone of US Pacific. If you are in another Time Zone, edit the file installtimezone.txt in the GemStone upgrade directory, then file it in as SystemUser.

The System Admin Guide has several pages discussing TimeZone and describing how to set it up for the System and for an individual session. If you have questions after reviewing those resources let us know.

James

On Jun 26, 2015, at 5:25 AM, Trussardi Dario Romano via Glass <[hidden email]> wrote:

Ciao,

i setup my TimeZone with:

run
| time |
time:= TimeZone timeDifferenceHrs: 1 dstHrs: 1 atTimeHrs: 2
fromDayNum: 95 toDayNum: 304 on: #Sunday beginning: 1967
stdPrintString: 'Germany Standard Time' dstPrintString: 'Germany Legal Time'.
TimeZone for:#Germany put: time.
TimeZone default: time
%

It's correct ?  ( I think not )

I don't remember where i found this definitions.

How i right setup the Timezone for Italy time?

I need to setup it every year with different parameter ?

Thanks for any considerations.

Dario


_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass


_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass
Reply | Threaded
Open this post in threaded view
|

Re: TimeZone

GLASS mailing list
Ciao James,

According to the Install Guide: 

GemStone/S 64 Bit is shipped with a default time zone of US Pacific. If you are in another Time Zone, edit the file installtimezone.txt in the GemStone upgrade directory, then file it in as SystemUser.

OK, i have edit the file installtimezone.txt   with 'Europe/Rome'

After file it in ( with topaz )  as SystemUser now the: TimeZone current standardPrintString 

answer:   'CET'


The System Admin Guide has several pages discussing TimeZone and describing how to set it up for the System and for an individual session.

In the System Admin Guide i found only this page relative to TimeZone : Current TimeZone

If you have questions after reviewing those resources let us know.

I need to read some other thinks ?

After update the TimeZone as upper, the problematic reported into my email:   Re: [Glass] Timespan Month  questions

remain open.


Thanks,

Dario


James

On Jun 26, 2015, at 5:25 AM, Trussardi Dario Romano via Glass <[hidden email]> wrote:

Ciao,

i setup my TimeZone with:

run
| time |
time:= TimeZone timeDifferenceHrs: 1 dstHrs: 1 atTimeHrs: 2
fromDayNum: 95 toDayNum: 304 on: #Sunday beginning: 1967
stdPrintString: 'Germany Standard Time' dstPrintString: 'Germany Legal Time'.
TimeZone for:#Germany put: time.
TimeZone default: time
%

It's correct ?  ( I think not )

I don't remember where i found this definitions.

How i right setup the Timezone for Italy time?

I need to setup it every year with different parameter ?

Thanks for any considerations.

Dario


_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass



_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass
Reply | Threaded
Open this post in threaded view
|

Re: TimeZone

GLASS mailing list
Hi Dario,

I’m glad you got the TimeZone issue resolved. As to the Timespan and Month issues, those might be related to rounding of floats, but since they aren’t part of GemStone’s base classes I’ll let others give their thoughts.

James

On Jun 29, 2015, at 6:09 AM, Trussardi Dario Romano via Glass <[hidden email]> wrote:

Ciao James,

According to the Install Guide: 

GemStone/S 64 Bit is shipped with a default time zone of US Pacific. If you are in another Time Zone, edit the file installtimezone.txt in the GemStone upgrade directory, then file it in as SystemUser.

OK, i have edit the file installtimezone.txt   with 'Europe/Rome'

After file it in ( with topaz )  as SystemUser now the: TimeZone current standardPrintString 

answer:   'CET'


The System Admin Guide has several pages discussing TimeZone and describing how to set it up for the System and for an individual session.

In the System Admin Guide i found only this page relative to TimeZone : Current TimeZone

If you have questions after reviewing those resources let us know.

I need to read some other thinks ?

After update the TimeZone as upper, the problematic reported into my email:   Re: [Glass] Timespan Month  questions

remain open.


Thanks,

Dario


James

On Jun 26, 2015, at 5:25 AM, Trussardi Dario Romano via Glass <[hidden email]> wrote:

Ciao,

i setup my TimeZone with:

run
| time |
time:= TimeZone timeDifferenceHrs: 1 dstHrs: 1 atTimeHrs: 2
fromDayNum: 95 toDayNum: 304 on: #Sunday beginning: 1967
stdPrintString: 'Germany Standard Time' dstPrintString: 'Germany Legal Time'.
TimeZone for:#Germany put: time.
TimeZone default: time
%

It's correct ?  ( I think not )

I don't remember where i found this definitions.

How i right setup the Timezone for Italy time?

I need to setup it every year with different parameter ?

Thanks for any considerations.

Dario


_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass


_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass


_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass
Reply | Threaded
Open this post in threaded view
|

Re: TimeZone

GLASS mailing list
In reply to this post by GLASS mailing list

On 06/29/2015 06:09 AM, Trussardi Dario Romano via Glass wrote:


After update the TimeZone as upper, the problematic reported into my email:   Re: [Glass] Timespan Month  questions

remain open.


It seems that the problem is that you are comparing the same local time from two different time zones:

{a} . -> 2015-04-30T23:59:59.99999898672104+02:00
(class)@ -> DateAndTime
(oop)@ -> 324717569
offset@ -> 7200
seconds@ -> 4,5212399999999899E+08

{b} . -> 2015-04-30T23:59:59.99999898672104+01:00
(class)@ -> DateAndTime
(oop)@ -> 324726017
offset@ -> 3600
seconds@ -> 4,5212759999999899E+08

Note that the local time in both cases is the exactly the same and that the offsets are different.

Consequently the seconds (UTC) are different and time {b} being from an earlier time zone has a greater UTC and therefore compares greater than {a}.

For consistency of record keeping, I think that you need to settle on a single TimeZone of record and use that for all timestamps.
That should then make the timestamp comparisons manageable.

Dale







_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass
Reply | Threaded
Open this post in threaded view
|

Re: TimeZone

GLASS mailing list
Another tidbit that I learned while investigating this is that when creating a month, the timeZone of the image is used unconditionally (true in both GemStone and Pharo). So the following can happen (on my machine):

  start := DateAndTime fromString: '2015-04-01T00:00:00+01:00'.
  month := Month starting: start.
  month start.

    ==>   2015-04-01T00:00:00-07:00

It's also true (and a bit less surprising) if you use a Date to create the month:

  (Month starting: (Date fromString: '04.01.2015')) start

    ==>  2015-04-01T00:00:00-07:00

Dale

On 06/30/2015 01:57 PM, Dale Henrichs wrote:

On 06/29/2015 06:09 AM, Trussardi Dario Romano via Glass wrote:


After update the TimeZone as upper, the problematic reported into my email:   Re: [Glass] Timespan Month  questions

remain open.


It seems that the problem is that you are comparing the same local time from two different time zones:

{a} . -> 2015-04-30T23:59:59.99999898672104+02:00
(class)@ -> DateAndTime
(oop)@ -> 324717569
offset@ -> 7200
seconds@ -> 4,5212399999999899E+08

{b} . -> 2015-04-30T23:59:59.99999898672104+01:00
(class)@ -> DateAndTime
(oop)@ -> 324726017
offset@ -> 3600
seconds@ -> 4,5212759999999899E+08

Note that the local time in both cases is the exactly the same and that the offsets are different.

Consequently the seconds (UTC) are different and time {b} being from an earlier time zone has a greater UTC and therefore compares greater than {a}.

For consistency of record keeping, I think that you need to settle on a single TimeZone of record and use that for all timestamps.
That should then make the timestamp comparisons manageable.

Dale








_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass